[Tutor] How to end this program
abid saied
abidsaied at gmail.com
Wed Aug 20 13:00:25 CEST 2014
# OK, I'm stuck on setting up an instruction that ends the program once you
# say either 'yes' or 'no'. And if you don't say 'yes' or 'no', and you reach
# the end, the program comes to an end. Please remember I'm a newbie and would
# appreciate any advise in plain simple English, like I was 5 years old!
import time
def main():
print()
print("YES/NO Game ")
time.sleep(2)
print()
print()
print("In this game, I will ask you a series of questions, if you answer YES or NO, you loose!")
print()
print("Remember to answer in Capitals!")
print()
time.sleep(2)
print("Starting the game ...")
print()
time.sleep(2)
name = input("What is your name? ")
print()
time.sleep(2)
print("ok " + (name) + (", time for the questions..."))
print()
time.sleep(2)
answer = input("How old are you? ")
if answer == "YES":
print("...You said yes, you loose!")
elif answer == "NO":
print ("...You said NO, you loose!")
answer = input("Do you like apples? ")
if answer == "YES":
print("...You said yes, you loose!")
elif answer == "NO":
print ("...You said NO, you loose!")
answer = input("Do you enjoy music? ")
if answer == "YES":
print("...You said yes, you loose!")
elif answer == "NO":
print ("...You said NO, you loose!")
answer = input("Have you ever been on a train? ")
if answer == "YES":
print("...You said yes, you loose!")
elif answer == "NO":
print ("...You said NO, you loose!")
answer = input("Do you watch 'Home and Away'? ")
if answer == "YES":
print("...You said yes, you loose!")
elif answer == "NO":
print ("...You said NO, you loose!")
answer = input("What is 50/5? ")
if answer == "YES":
print("...You said yes, you loose!")
elif answer == "NO":
print ("...You said NO, you loose!")
answer = input("Can a duck fly? ")
if answer == "YES":
print("...You said yes, you loose!")
elif answer == "NO":
print ("...You said NO, you loose!")
answer = input("Can you drive a car? ")
if answer == "YES":
print("...You said yes, you loose!")
elif answer == "NO":
print ("...You said NO, you loose!")
answer = input("Do you still watch cartoons? ")
if answer == "YES":
print("...You said yes, you loose!")
elif answer == "NO":
print ("...You said NO, you loose!")
answer = input("Can a duck fly? ")
if answer == "YES":
print("...You said yes, you loose!")
elif answer == "NO":
print ("...You said NO, you loose!")
print("OK, you win!You didn't say 'YES' or 'NO', well done!")
time.sleep(2)
Abid Saied
abidsaied at gmail.com
More information about the Tutor
mailing list