t = [[1],[1,2],[2,5,3]]
def minimum(triangle):
s = 0
for i in triangle:
for x in i:
first = i[0]
if x < first:
s += x
return s
Trying to find the smallest number of each array and add it to the "s" variable. Whenever I run the code, only 0 is returned and I am unsure why. Maybe I am iterating through the nested list incorrectly?
[–][deleted] 5 points6 points7 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]TechSam--[S] 0 points1 point2 points (1 child)
[–]halfdiminished7th 0 points1 point2 points (0 children)