0
How do I use âelifâ and âelseâ statements in this case?
What is wrong with my code? Produces SyntaxError in line 7 but other lines may also be incorrect: level = 5 highest_level = 50 print(level == highest_level) if highest_level: 50 print("wow, you're level 50 alright!") elif highest_level == > 50 print ("still gotta long way to go shawty!") else: print("ok ok okayyyy ok")
4 Answers
+ 11
Saman Salih ,
why not start learning in a python tutorial? it will shorten your way to a required knowledge level.
happy coding!
+ 4
On line 4 do you mean:
if highest_level=50:
On line 5 you should add spaces before the print statement if you only want to print the text if highest_level is equal to 50.
On line 7 add a colon : after 50. And do you want to see if it is equal or major you cannot combine both signs == or > or >= (major or equal sign).
So I think it should be:
level = 5
highest_level =50
print(level==highest_level)
if highest_level ==50:
print("wow...")
elif highest_level >= 50:
print("still...")
else:
print("ok...")
Hope this helps.
+ 1
Take another look at these topics:
- indentation
- comparison operators
0
Lebi in the if statement you have to use the comparison operator "==", not the assignment operator "=".