Why the result is showing 1,2,3,4,5,6?where did the 6 come from? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why the result is showing 1,2,3,4,5,6?where did the 6 come from?

i = 1 while i <=5: print(i) i = i + 1 print(i)

15th Sep 2020, 12:23 PM
Muhtasinul
Muhtasinul - avatar
5 Answers
+ 4
1. Loop Print 1 i=2 2.Loop Print 2 I=3 .... 5.Loop Print 5 i=6 Loop stops Print 6
15th Sep 2020, 12:33 PM
Oma Falk
Oma Falk - avatar
+ 3
In last loop i =5 5 is printed and after incremented to 6 The print behind the loop prints the 6
15th Sep 2020, 12:26 PM
Oma Falk
Oma Falk - avatar
15th Sep 2020, 12:34 PM
Ayush Kumar
Ayush Kumar - avatar
0
Oma Falk bro..i'm still not clear
15th Sep 2020, 12:30 PM
Muhtasinul
Muhtasinul - avatar
0
Oh...thnx bro😄
15th Sep 2020, 12:34 PM
Muhtasinul
Muhtasinul - avatar