Answer the question
In order to leave comments, you need to log in
How to more concisely solve the following problem?
Given a list consisting of lists, each of which includes two elements - a string and the result of a calculation. You need to get the sum of all second elements. Below is my solution code. I think there are better solutions. Tell me please.
a = ['asd', 1 / 5]
c = ['asda', 1 / 6]
b = [a, c]
summ = 0
for i in range(0, len(b)):
summ += b[i][1]
print(summ)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question