- 1
Problem with python script
Variable = input("Your number is ") if Variable = 50 print("I dont like your number") else print("I like your number") syntax error? Solved by N3tW0rk
5 ответов
+ 4
it must be
if Variable == 50: # Double = and : after 50
print("....")
else: # : here too
print("---")
double == to compare and one to assign a value to a variable and respect indentation
+ 3
u should put Variable = int(input("---")) too instead of just input cause just input is string
+ 1
works now, the else was indented and it shouldnt have been
0
It now says theres a syntax error on line 4 aka
else:
0
Along with the == issue you need to add a : to the end of your if and else statements. You should also wrap your input () with int () otherwise you're comparing a string "50" to an integer 50.
variable = int(input("Your number is "))
if variable == 50:
print("I dont like your number")
else:
print("I like your number")