S
S
Sergey2018-09-07 09:13:43
Python
Sergey, 2018-09-07 09:13:43

How to get element 2 from nested list?

For example a=[1,2,3]
b=[a[1],999],[a[2],100],[a[2],400]
how to get 999 ,100,400 ?
and fold them

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
Teslaman, 2018-09-07
@Serjdragonknight

You can get it like this:
b[0][1], b[1][1], b[2][1]

S
Sergey Tikhonov, 2018-09-07
@tumbler

sum(x[1] for x in b)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question