if statement : what is wrong with code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

if statement : what is wrong with code

Check this out!! If, elif & else conditions. price = 60 if price > 100: print("price is greater than 100") elif price == 100: print("price is 100") else price < 100: print("price is less than 100")

14th Jul 2022, 3:39 AM
Mazen
2 Answers
+ 7
Nothing should come after “else”. Instead of writing “else price < 100”, just write “else”. Like this: price = 60 if price > 100: print("price is greater than 100") elif price == 100: print("price is 100") else: print("price is less than 100")
14th Jul 2022, 3:50 AM
Hamsdino
Hamsdino - avatar
+ 3
thank you very much
14th Jul 2022, 3:56 AM
Mazen