Python Forum

Full Version: syntax error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
print("age restriction")
age=int(input("pls enter your age:"))
if age<=18:
print("access restricted for users below 19")
else:
print("access granted")
print("enter your name")
name1=(input("enter name: "))
print("welcome",name1)

access=int(input("if you already signed up press 1 , if you are a new user press 2")
if access=1:
username=(input("enter username"))
access=(input("enter pswd"))
print("welcome",username)
else:
print("go to link and pls register")


input("press any key to exit")


Invalid syntax error popup is displayed in 2nd if statement when i am trying to run this programe
pls help me out asap i have just stared to learn programming
thankyou
Please put your code in Python code tags and full error traceback message in error tags. You can find help here.
Oh well, error in your case is pretty simple (I didn't even take a closer look at first)... this line:
if access=1:
means assignment (single equality sign), while you want to use == to check for equality.
Also, if you compare to '1' instead of 1, you don't even need to cast input to integer, but that's a detail.
Hi j.crater
thanks for your help
i am new to programming