[Tutor] Hands-on beginner's project?
Steve Willoughby
steve at alchemy.com
Fri Oct 3 19:35:13 CEST 2008
On Fri, Oct 03, 2008 at 09:38:56AM -0700, Chris Babcock wrote:
> room = 1
> while 1:
Also, it may be more clear to say "while True:" in preference
to "while 1:". Note that in your earlier version you didn't
capitalize "True" which meant Python had no idea what that
value was (could be a variable or something). True and False
(and None, for that matter) are all capitalized.
> if room == 1:
> # Room 1 stuff
> elif room == 2:
> # Room 2 stuff
This is a good start while you're learning to program initially.
You'll later want to see how to generalize this so the collection
of rooms and connections between them exists in _data_ instead
of _code_. Something to simmer on the back burner until you're
ready for that step.
--
Steve Willoughby | Using billion-dollar satellites
steve at alchemy.com | to hunt for Tupperware.
More information about the Tutor
mailing list