[Tutor] (no subject)

ADRIAN KELLY kellyadrian at hotmail.com
Mon Oct 17 22:01:19 CEST 2011



Hello world, can anyone tell me how i can perfect the program below. 
it works find (prints 6 random numbers within a range) but on occasions the numbers are repeated.
 
Thanks so much everyone
 
#program that will allow the user to generate random numbers
#from a range that they select.
 
import random
 
#set values
number=0
 
base=input ("Enter the bottom of the range? ")
upper=input ("Enter the upper limit of your range: ")
quantity=input ("How many numbers do you want to select: ")
number =0
 
while number<quantity:
    print random.randint(base,upper)
    number=number+1
   
    
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111017/0a2757d9/attachment.html>


More information about the Tutor mailing list