[Tutor] python problem

Chris balderas at whtvcable.com
Wed Sep 26 04:49:52 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')

I can't seem to get the guts of it.  I assume that there are 3 if statements
and a while statement.

guess

While x != 
	If guess 



I get lost right around here...help!


import random
> number = random.randint(1, 101)
> print "I've thought of a number between 1 and 100."
> print "Try and guess it!"
> print
> guess = input( "What's your guess? ")
> while guess != number:
>     if guess > number:
>         print "Your guess is too high."
>     else: #elif guess < number:
>         print "Your guess is too low."
>     guess = input( "What's your next guess? " ) print 
> "Congratulations! You guessed the number."
-----Original Message-----
From: Kent Johnson [mailto:kent37 at tds.net] 
Sent: Tuesday, September 25, 2007 7:32 PM
To: Chris
Cc: tutor at python.org
Subject: Re: [Tutor] python problem

Chris wrote:

> Guess the number from the user using 1,2,3 keys
> 	Ask the user if # is high, low, or dead on.
> 		Print 'you got it' when Python gets it.
> 
> As you can see I need help. I've given you the pseudo code.

OK, how about some real code? If we write the program for you that won't 
help you learn. What have you tried so far? Which parts of the 
pseudocode do you know how to code? Which parts do you need help with?

Kent




No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.487 / Virus Database: 269.13.25/1018 - Release Date: 9/19/2007
3:59 PM
 

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.487 / Virus Database: 269.13.25/1018 - Release Date: 9/19/2007
3:59 PM
 



More information about the Tutor mailing list