[Tutor] Python program with multiple answers
Alan Gauld
alan.gauld at btinternet.com
Wed May 11 17:17:17 CEST 2011
"Johnson Tran" <aznjonn at me.com> wrote
> import random
> dice = ...
> while True:
> ...
> elif choice == "quit":
> True = 0
> raw_input()
Do not do this! True is supposed to be a fixed,
constant boolean value. In fact in Python v3 you
will get an error if you try it.
Instead use break to exit from the loop.
> else:
> print "Error -- Try again\n"
HTH
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list