On 05/08/2014 06:00 AM, Kevin Johnson
wrote:
This is a classic game. The first issue I see is the while exit condition. I prefer to use: max_guess = 7 # I believe this game can be won in 7 guesses if the correct strategy is used. guess = 0 initial_guess = random.randrange(1, 100) while guess < max_guess: do stuff guess += 1 Also, I would model how you would play this game efficiently against a person. Then write the "do stuff" to replicate that. Hint: you do not need to generate random guesses within the while loop. -- Jay Lozier jsloz...@gmail.com |
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor