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:

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"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.