[Tutor] python problem
kent37 at tds.net
Wed Sep 26 14:14:37 CEST 2007
> Ok as I see it, it's should go like this:
> Print 'Think of a number between 1 and 100, and let me guess it'
> Type1 = input ('Type 1 if I am high')
> Type2 = input ('Type 2 if I am low')
> Type3 = input ('Type 3 if I am dead on')
This will ask for three different inputs which is not what you want. Can
you modify it to ask for input just once?
> I can't seem to get the guts of it. I assume that there are 3 if statements
> and a while statement.
That sounds about right.
> While x !=
> If guess
OK, you have some of the pieces. Maybe it would help to write a more
detailed pseudocode. I think it might be:
ask the user to pick a number
wait for the user to pick a number
pick a starting guess
tell the user my guess
ask if the guess is correct
if the guess is correct
if the guess is too high
pick a lower guess
if the guess is too low
pick a higher guess
Can you turn this into code?
More information about the Tutor