[Tutor] Random Number Question

Jeff Goodwin jeffbgoodwin at gmail.com
Wed Nov 24 22:51:26 CET 2010


I'm trying to find a way to use the random.randint function to generate a
random number, but everytime I run the program it locks up IDLE. Here is
what I have so far:

import random

def main():
     x = input("Enter a number: ")
     y = input("Enter a different number: ")

     z = random.randint(x,y)

print "The random number between ", x, " and ", y, " is ", z


Can you tell me where I'm going wrong here? When I run the program it allows
me to enter the numbers for x and y, then freezes.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101124/5f3745d6/attachment.html>

More information about the Tutor mailing list