New course! Every coder should learn Generative AI!
Try a free lesson0
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")
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")
+ 3
thank you very much