syntax error - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: syntax error (/thread-11180.html) |
syntax error - judin - Jun-26-2018 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 RE: syntax error - j.crater - Jun-26-2018 Please put your code in Python code tags and full error traceback message in error tags. You can find help here. RE: syntax error - j.crater - Jun-26-2018 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. RE: syntax error - judin - Jun-27-2018 Hi j.crater thanks for your help i am new to programming |