In first half of this script:

prompt = raw_input("Can you tell me your name? ")
if prompt in ("Yes", "yes", "y", "Y"):
    name = raw_input("What's your name? ")
elif prompt in ("No", "no", "n", "N"):
    exit("OK, have nice day..")
else:
    prompt = name

if name == "Santosh":
    print "Hey! I have the same name."
elif name in ("John Cleese", "Michael Palin"):
    print "I have no preference about your name. Really!!"
else:
    print "You have a nice name."

I want that if anyone enter their name at the first prompt the name
should be stored in "name" variable, or else if they enter anyone of
("Yes", "yes", "y", "Y") they should be given another prompt where
they can enter their name. But currently when I enter name other than
("Yes", "yes", "y", "Y") it says that name is not defined. How can I
fix this?
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to