What's the invalid syntax in the following
code?
# Hurkle Hunt
# This program is a game where you have to find a hurkle that the computer hides in a grid. # Originally in Computer World pg. 70 import random
print "Hunt the Hurkle"
while 1: ans = raw_input("Do you want to play a game? Type Y to play, any other letter to quit.") while ans == "y" | ans == "Y": E = random.choice(range(9)) N = random.choice(range(9)) k = 1 while k <= 5: print "Guess ", %d1.0, "."(k) X = int(raw_input("East Guess: ")) Y = int(raw_input("North Guess: ")) if X > E & Y == N: print "Go West" k = k + 1 elif X > E & Y > N: print "Go SouthWest" k = k + 1 elif X > E & Y < N: print "Go NorthWest" k = k + 1 elif X == E & Y > N: print "Go South" k = k + 1 elif X == E & Y < N: print "Go North" k = k + 1 elif X < E & Y == N: print "Go East" k = k + 1 elif X < E & Y > N: print "Go SouthEast" k = k + 1 elif X < E & Y < N: print "Go NorthEast" k = k + 1 else: print "Congrats! You found the hurkle in", %d1.0, " guesses!" (k) break else: print "You didn't find the hurkle in 5 tries! It was at: ", E, ",", N break else: break print "Goodbye!" break Thanks!
Nathan Pinno
|
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor