I want to create a program that will say correct or incorrect when a user types down a answer.
I tried using Python storing variables to solve the problem but to no avail
The code is a bit like this
question1 = input ("Type down a password!")
if input = "bannanas"
print('Sucess!')
else print("ohhhhh")
But the terminal says
File "main.py", line 2
if input = "bannanas"
^
SyntaxError: invalid syntax`enter code here`
Use the comparison operator, ==
, instead of the assignment operator (=
):
question1 = input("Type down a password!")
if input == "bannanas": print('Success!')
else: print("ohhhhh")
You also have a few other syntatical errors, like missing colons (which I added).