+ 1

Can any one say me why the numbers in range are not printing?

https://code.sololearn.com/cZwx5tTDV3l7/?ref=app

10th Dec 2019, 7:59 AM
Abhishek
Abhishek - avatar
2 odpowiedzi
+ 5
ABHISHEK GERA in your code X = 0 is initialised and further X is used only in true condition where x = x+1 So in last statement you used only X==2 in condition which evaluate too true at once and print 11 and terminated. I've updated your code slightly look over that https://code.sololearn.com/cjlwUpQ41fGM/?ref=app
10th Dec 2019, 8:11 AM
GAWEN STEASY
GAWEN STEASY - avatar
0
Only the number 11 is being printed. That's because your x variable is not being reset on every cycle. To correct your code, just move your "x = 0" declaration to inside the first for loop, right at the beginning. for i in range(11,33): x = 0 ... # the rest is the same Happy coding!
10th Dec 2019, 8:14 AM
Gonçalo Magalhaes
Gonçalo Magalhaes - avatar