0

Infinite loop and breaking it.

i=0 while 1==1: print (i) i = i + 2 if i>= 20 print ("It's enough") break What's mistake here? Please let me know it and even its solution.

17th Dec 2016, 11:05 PM
‎‏‪‏‪Tarami Nishan‬‏‬‏‎
‎‏‪‏‪Tarami Nishan‬‏‬‏‎ - avatar
5 Answers
+ 1
i=0 while i<20: print(i) i=i+2 print("It's enough")
17th Dec 2016, 11:11 PM
Farid Ghr
Farid Ghr - avatar
+ 1
thanks Farid but i wanted to create an infinite loop and break it rather than just a conditional. could you help me with that.
17th Dec 2016, 11:59 PM
‎‏‪‏‪Tarami Nishan‬‏‬‏‎
‎‏‪‏‪Tarami Nishan‬‏‬‏‎ - avatar
+ 1
Your code is alright, but there is a missing : after if statement. And indentation are not right
18th Dec 2016, 12:25 AM
Rishi Anand
Rishi Anand - avatar
+ 1
my pleasure
18th Dec 2016, 4:13 AM
Rishi Anand
Rishi Anand - avatar
0
oh yeah , thanks Rishi 😃😃 didn't see it 😂😂
18th Dec 2016, 4:11 AM
‎‏‪‏‪Tarami Nishan‬‏‬‏‎
‎‏‪‏‪Tarami Nishan‬‏‬‏‎ - avatar