What is wrong with this code? Please help; I'm a newbie | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is wrong with this code? Please help; I'm a newbie

if 15<4: print ("lesser than four") elif 15<8: print ("lesser than eight") elif 15 <20: print ("lesser than twenty")

10th Jun 2018, 5:14 PM
Athar
Athar - avatar
2 Answers
+ 1
In python, if, elif and else need to have the same indents, if they belong to the same if-statement. An if-statement works like this: if #condition : #do something elif #condition : #do something else else: #...
10th Jun 2018, 5:24 PM
Moritz Vogel
Moritz Vogel - avatar
+ 1
Thanks a lot! I changed the code like you wrote and it worked! :)
10th Jun 2018, 5:27 PM
Athar
Athar - avatar