What's wrong in this | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's wrong in this

num = 7 if num == 8: print("no,its not") else: if num >= 10: print("Yes,it is") else: if num <= 10: print("7 is smaller than 10") what's wrong in this. Explain in detail

20th Apr 2020, 5:52 AM
Eco Fico
Eco Fico - avatar
2 Answers
+ 1
Your indentation levels are off. Otherwise it's not technically wrong. num = 7 if num == 8: print("no,its not") else: if num >= 10: print("Yes,it is") else: if num <= 10: print("7 is smaller than 10") it can be rewritten num = 7 if num == 8: print("no,its not") elif num >= 10: print("Yes,it is") elif num <= 10: print("7 is smaller than 10")
20th Apr 2020, 6:05 AM
ChaoticDawg
ChaoticDawg - avatar
20th Apr 2020, 6:28 AM
A͢J
A͢J - avatar