On 09/08/12 04:26, Lily Tran wrote:
I am getting the following error when I try to run this python program
in eclipse. I am running python 3:
I see you fixed that,but there are other problems:
def MagicEightBallEmulator():
answers = ["As I see it, yes",
....
"Very doubtful"]
while True:
what = random.choice(answers)
This loop will go on forever. I don't think you want a loop here you
just want to select a choice once.
return print(what)
print is a function which returns None.
So your function returns None. Youcan therefore eiother dispense with
the return statement and Python will return None as default, or, as
better practice, "return what" and put the print() call in your main
function:
MagicEightBallEmulator()
becomes
print( MagicEightBallEmulator() )
HTH,
--
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