thais code doesn't work as i thought ! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

thais code doesn't work as i thought !

when i ran the code: mj = 1 while True: print (mj) mj+= 1 if mj==13: print ("the deep number!") if mj==14: continue if mj<=34: break print ("the party ended!") it just results: "1 the party ended!" why? where is the wrong? ▶ thanks for your effort.

17th Sep 2016, 9:51 AM
مُحَمَّدٌ صَالِحُ
مُحَمَّدٌ صَالِحُ - avatar
2 Answers
+ 2
if mj<=34: break mj is less than 34 at the start, and the loop ends immediately once it reaches that if. You probably meant to write: if mj>34: break
17th Sep 2016, 10:02 AM
Zen
Zen - avatar
0
yes i missed that :) thanks zen.
17th Sep 2016, 3:50 PM
مُحَمَّدٌ صَالِحُ
مُحَمَّدٌ صَالِحُ - avatar