- Code: Select all
name = raw_input("Hello, What is your name?")
if len(name) > 0:
print ("Hello " + name + "! Nice to meet you. I am the God of Awesomeness. However, you can call me Gabriel.")
play_game = raw_input("Well then, " + name + ", would you like to play a game?")
if play_game == "Yes" or "yes" or "y":
print("Excellent! Lets continue. We will play...... the conversation game. yes, you will have a conversation with me.")
print "I will ask questions first"
color = raw_input("What is your favorite color?")
print color + ", hmm, interesting. Mine is Green!"
age = raw_input("How old are you?")
if age < 18:
print "well, you are well on your way to the dreadful 'real world'"
print "interesting, so you are " +age+ ". Thats great. You gain more life experience with every year!"
print "Well, that was it! Goodbye!"
elif play_game == "No" or "no" or "n":
print("well then, that is quite disappointing. Goodbye, " + name + ".")
print ("I do not understand your words of wisdom. Perhaps you shall try an answer like yes or no?")
elif len(name) <=0:
print ("how about you actually type something?")
anyways, whenever I run the code, except for when I ask for a name, the code accepts any input. For example, if i were to answer 'no' to the question that asks if the user wants to play a game, the code runs the IF statement regardless. However, since my code is running in the first place, I'm assuming that the syntax is correct.
Any help is appreciated!