[Tutor] Value asign to random.randrange

Glen Wheeler gew75 at hotmail.com
Wed Jun 9 04:36:41 EDT 2004


  How about;

number = random.randint(1,10) # number between 1 and 10
number = str(number) # for comparing the number and the user's guess
answer = ''
while answer != number:
  answer = raw_input("What is your guess? ")
print "Correct!"

  It has some flaws, but you can work those out ;).

  Glen

----- Original Message ----- 
From: "Ivan low" <visional_freeman at yahoo.com>
To: <tutor at python.org>
Sent: Wednesday, June 09, 2004 6:01 PM
Subject: [Tutor] Value asign to random.randrange


> Hi, I was thinking to asign some value to the program,
> when random number was generated, that number will be
> a question that ask the user. I found it hard to asign
> number to my qustion. Does anybody know how to go
> about this?
> 
> Ivan
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 



More information about the Tutor mailing list