+ 2
Invalid syntax in multiple if statements
num = 12 if num > 5: print("Bigger than 5") if num <=47: print("Between 5 and 47") if num = 12 print("yeboi") Why do I get invalid syntax pointing to the = sign?
6 ответов
+ 9
write "num == 12:" instead of "num = 12"
And please specify the language of this code.
Many people may not understand its python.
+ 5
@adithiya you forgot colon :
+ 1
Ah yes I forgot to specify the language. Thanks
+ 1
num = 12
if num > 5:
print("Bigger than 5")
if num <=47:
print("Between 5 and 47")
if num == 12
print("yeboi")
Eh but the syntax error here points at the integer 2
I tried what you said and still got an error
+ 1
Oh no wonder lol thanks. Haiz I go java curly bracket is a pain now in python cuz of a colon a whole code errors out