+ 1

Need only last figure in output

N = int(input()) sum = 0 for N in range(0, N+1): sum += N print (sum)

7th Jul 2022, 7:35 PM
Терещенко Дмитрий
Терещенко Дмитрий - avatar
5 Answers
+ 2
N = int(input()) sum = 0 for N in range(0, N+1): sum += N # belong to loop. print (sum) # this one is not belong to loop.
7th Jul 2022, 7:49 PM
Jayakrishna 🇮🇳
+ 1
Thank you!
7th Jul 2022, 7:50 PM
Терещенко Дмитрий
Терещенко Дмитрий - avatar
+ 1
It's all about how identation works in python. So this may help you further.. Hope it helps. https://code.sololearn.com/cT5BRIbkia21/?ref=app You're welcome..
7th Jul 2022, 7:53 PM
Jayakrishna 🇮🇳
0
Ident it out of loop. Currently it is inside loop.
7th Jul 2022, 7:38 PM
Jayakrishna 🇮🇳
0
I dont understand what must i do whith loop
7th Jul 2022, 7:48 PM
Терещенко Дмитрий
Терещенко Дмитрий - avatar