Syntax issue | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Syntax issue

>>> i=0 >>> while True: i=i+1 if i==2: print("Skipping 2") continue if i==5: print("Breaking") break print(i) print("Finished") 1 Finished Skipping 2 3 Finished 4 Finished Breaking >>> Why does print(i) have to be positioned where it is?

19th Feb 2017, 10:51 PM
Sam Consiglio
Sam Consiglio - avatar
1 Answer
+ 3
because Python doesn't use brackets to determine blocks of code, but uses whitespace instead.
19th Feb 2017, 10:53 PM
Mario L.
Mario L. - avatar