f=[] for i in range (5): line = [] for j in range (5): line.append(random.randint(1,10)) f.append(line) for each in f: print(each) print (sum(each))
Output:[10, 7, 6, 2, 9]
34
[3, 8, 4, 7, 1]
23
[1, 2, 10, 5, 1]
19
[3, 3, 2, 9, 10]
27
[10, 1, 5, 4, 1][10, 7, 6, 2, 9]
34
[3, 8, 4, 7, 1]
23
[1, 2, 10, 5, 1]
19
[3, 3, 2, 9, 10]
27
[10, 1, 5, 4, 1]
21
21
It works. Maybe you made a mistake with indentation.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!