Hi Guys,
I've been working on a Python program where I create an 8 ball that will allow
you to ask questions and will reply back with 20 possible answers. It will be
continuous until the user says quit. My program works fine although I am trying
to add something more to it, where when the user quits, it will present all the
answers that the user got again and display them in alphabetical order...if
anyone could point me in the right direction it'd be really helpful...my
program so far is : (which works fine with no errros)
import random
dice = ("Without a doubt", "It is certain", "It is decidedly so","Yes", "For
Sure", "No", "Dont count on it", "Try asking again","Reply hazy, try again",
"Confucious says 'No'", "Better not tell you now","Cannot predict
now","Concentrate and ask again","My reply is no","Outlook not so good","Very
doubtful","Outlook is good","Most likely","As I see it, yes","I do not
understand the question")
while True:
choice = raw_input("Type 'ask' to ask a question. Type 'quit' to
quit.\n")
if choice == "ask":
raw_input("Please enter your question:\n")
roll = random.randint(0, 10)
print dice[roll]
raw_input()
elif choice == "quit":
True = 0
raw_input()
else:
print "Error -- Try again\n"
Thanks,
JT
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor