On 22/07/12 06:58, Santosh Kumar wrote:
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
Don't you want name = prompt?
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?
-- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor