while i<10:
a = a + i
print (a)
i = i+1
or
for i in range(10):
sum = sum + i
print
0
1
3
6
10
15
21
28
36
45
Then how can I add them together by writing further codes? I mean 1+3+6+10+15+21+... Then set the total as variables! That would be great if you can show me in both loop :)
help(sum)at the interpreter console, because it may help you here.)