0

Hi
i Made a shell script like this

name = raw_input ("Please enter your name: ")

if name == Harry: 
        print "Welcome"
else:
        print "you smell"

What i want it to do is ask for my name and if i dont enter Harry it says "YOU Smell"
But when i run it this comes up

Traceback (most recent call last):
File "H:\Scripts\test.py", line 4, in <module>
if name == Harry:
NameError: name 'Harry' is not defined

can anybody tell me where i am going wrong .

Thanks

HLA91

STAY COOL AND DONT GET STRESSED!:cool:

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by vegaseat
0

Notice that raw_input() returns a string, so you have to put Harry in quotes ...

name = raw_input ("Please enter your name: ")

if name == "Harry": 
        print "Welcome"
else:
        print "You smell"
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.