CoCalc Public FilesSumAlg.ipynbOpen with one click!
Author: Kaleb Cruz
Views : 58
Compute Environment: Ubuntu 20.04 (Default)
In [ ]:
list = [1,2,3,4,5] sum = 0 for i in list: sum += list[i - 1] print(sum)
In [41]:
list = [1,2,3,4,5] sum = 0 i = 0 while i < 5: sum += list[i] i = i + 1 print(sum)
15
In [ ]:
In [ ]: