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!!')
9 odpowiedzi
+ 10
Don't use any condition after else. If needed, then use elif.
+ 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
+ 2
Did you have the :
after the condition?
0
Thanks!!!
0
So now its coming up with a syntax error for v
0
can you share script
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
0
give Tanner in single quotes
0
Could you write that out in code im not sure what you mean