[Tutor] Hands-on beginner's project?

Chris Babcock cbabcock at asciiking.com
Fri Oct 3 18:38:56 CEST 2008


> Loops, then? The  code this is based off of  had the second line of
> actual code (between "room = 1" and "if room ==1") as "while true:",
> but when I include this, it gives an error at that line. Is there
> another way to do that? Maybe "while room != 4.2"?

What you had before was...

room = 1
if room == 1
  # Room 1 stuff
elif... #Stuff that never got executed
# End of program.


Try...

room = 1
while 1:
  if room == 1:
    # Room 1 stuff
  elif room == 2:
    # Room 2 stuff

Your switching variable can't be the loop control and you do need to be
in a loop for the conditional expression to be evaluated again after
you've changed the value of room.

Chris


-- 


Make a difference in the world and support more Diplomacy projects and
services then you can shake a dagger at, please read:

http://members.bluegoosenews.com/diplomacy/blog/2008/09/24/a_special_note_for_diplomacy_players
 - or - 
http://tinyurl.com/3wx6lb 

Blue Goose is willing to give me $250 to support various services and
projects in the Diplomacy hobby. The blog post above will tell you why
they are doing this, what I will do with the money, and what you can do
to help me get it.


More information about the Tutor mailing list