0

Hey guys im trying to male a simple login use variables and inputs. Can i have some help with my code! A syntax error keeps coming up where i state x = v. print 'Hello User' x = 'Tanner' v = input('ENTER YOUR NAME HERE') if x = v print ('\n Welcome Tanner!') else x != v print ('\n User Not Found!!')

19th May 2017, 5:50 PM
Tanner
9 Answers
+ 10
Don't use any condition after else. If needed, then use elif.
19th May 2017, 6:08 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 3
= is not comparing to see if x is equal to v. It is assigning x to the value of v. use == for comparing. if x == v : # do this else : # do this
19th May 2017, 5:56 PM
Rrestoring faith
Rrestoring faith - avatar
+ 2
Did you have the : after the condition?
19th May 2017, 6:05 PM
Rrestoring faith
Rrestoring faith - avatar
0
Thanks!!!
19th May 2017, 5:56 PM
Tanner
0
So now its coming up with a syntax error for v
19th May 2017, 5:57 PM
Tanner
0
can you share script
19th May 2017, 6:04 PM
Sriram Chowdary Mellamputi
Sriram Chowdary Mellamputi - avatar
0
Yeah i Figured it out. But should 'tanner' be a string?? Now this is coming up: Traceback (most recent call last): File "Login.py", line 3, in <module> v = input('ENTER YOUR NAME HERE') File "<string>", line 1, in <module> NameError: name 'Tanner' is not defined
19th May 2017, 6:07 PM
Tanner
0
give Tanner in single quotes
19th May 2017, 6:09 PM
Sriram Chowdary Mellamputi
Sriram Chowdary Mellamputi - avatar
0
Could you write that out in code im not sure what you mean
19th May 2017, 6:10 PM
Tanner