[Tutor] Python Programming for the absolute beginner 3e, Ch3 Challenge 4

ALAN GAULD alan.gauld at btinternet.com
Fri Aug 9 10:11:07 CEST 2013



# Write the psudocode for a program where the player and the computer
># trade places in the number guessing game.  That is, the player picks a 
># random number between 1 and 100 that the computer has to guess.
># Before you start, think about how you guess.  If all goes well, try
># coding the game.
>
>
>It builds on the previous challenge, where the user guesses the number - I coded that OK, as below.OK, So which bits of this challenge puzzle you?

Can you write down the process you used when guessing the numbers?
Can you turn that description into pseudo-Python code?

Hint:
You need to get the computer  to generate numbers in an ever narrowing range, 
Maybe the midpoint number? (You could also google "binary chop" to get 
more ideas)

Then you need to tell the computer which direction it should go next.

Have a stab at it, get back to us with what you've come up with.

HTH

Alan G.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130809/ac6d7971/attachment.html>


More information about the Tutor mailing list