- 1

Can't find...

n = 1 while n <=10: print(n) n = n + 1 print("albert").... why code is resulting.. 1 albert 2 albert 3 albert...... instead of 1 2 3 4 5..... albert

30th Mar 2018, 9:59 AM
ALBERT SAURAV
ALBERT SAURAV - avatar
2 Answers
+ 4
just remove a space before the print("albert") because python thinks it's still in the loop
30th Mar 2018, 10:02 AM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 2
it looks like that print(albert) is in the same loop as the counter.
30th Mar 2018, 10:18 AM
storm
storm - avatar