+ 3
Why it's runs only 2 time when I give no. Of students 4??
I had made this code in pyroid3 , https://code.sololearn.com/coBuhDZNY3EZ/?ref=app
4 ответов
+ 5
for i in (0,P) iterates a tuple of length 2 so loop runs twice
for i in range (0, P) iterates over a range object
See:
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2434/
+ 3
Thank you Kevin ★,Angelo Landi I do silly mistakes
+ 2
for i in (0, P) means i=0 and i=P
What you want is for i in range(P)
+ 2
Angelo Landi yes