+ 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

25th Nov 2020, 1:14 AM
🤴🌹Cute Princess 🌹💐
🤴🌹Cute Princess  🌹💐 - avatar
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/
25th Nov 2020, 1:17 AM
Kevin ★
+ 3
Thank you Kevin ★,Angelo Landi I do silly mistakes
25th Nov 2020, 1:23 AM
🤴🌹Cute Princess 🌹💐
🤴🌹Cute Princess  🌹💐 - avatar
+ 2
for i in (0, P) means i=0 and i=P What you want is for i in range(P)
25th Nov 2020, 1:18 AM
Angelo
Angelo - avatar
25th Nov 2020, 1:22 AM
🤴🌹Cute Princess 🌹💐
🤴🌹Cute Princess  🌹💐 - avatar