[Tutor] Guess my number game

delegbede at dudupay.com delegbede at dudupay.com
Sat Nov 19 14:14:42 CET 2011

Hi Myles,

Pseudocodes are what anyone would write but they only lay an idea of what you intend to achieve. 

To get quick help, you need to write the actual code and tell us where the trouble spot is. 

This way we can help you get along. 

Sent from my BlackBerry wireless device from MTN

-----Original Message-----
From: myles broomes <mylesbroomes at hotmail.co.uk>
Sender: tutor-bounces+delegbede=dudupay.com at python.org
Date: Sat, 19 Nov 2011 12:53:40 
To: <tutor at python.org>
Subject: [Tutor] Guess my number game

I am currently learning Python from the 'Python Programming for the Absolute Beginner' book. At the end of each chapter, you are given challenges and one of the challenges is to make a 'Guess My Number' game where the player thinks of a number between 1 and 100 and the computer has to guess the number. I'm having real trouble designing the 'guessing loop' where the computer guesses the players number. Here is the pseudocode I have written up:

Welcome the user to the game
Explain the rules of the game
Wait for the user to think of a number
Once the user has thought of their number, take a guess
While the number has not been guessed correctly
	Increase the number of 'tries' by 1
	Ask the user if the guess was too high or too low
	If the guess was too high
		guess lower
	If the guess was too low
		guess higher
Once the number has been guessed correctly, tell the user the number of tries it took
Exit the game

Any help would be very much appreciated.
Tutor maillist  -  Tutor at python.org
To unsubscribe or change subscription options:

More information about the Tutor mailing list