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

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 please tell

20th Apr 2020, 5:36 AM
Eco Fico
Eco Fico - avatar
2 Answers
+ 2
You have used wrong else statement on line no 7. This should be look like 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")
20th Apr 2020, 5:41 AM
A͢J
A͢J - avatar
0
You can't use else statement twice for just one if statement.
20th Apr 2020, 5:42 AM
kiclause
kiclause - avatar