Ok, so I just started learning python and I've made a simple random number generator already but now I want the user to define the range in which the number can be generated. This is what I have so far but I cant seem to figure out what to do for line 7. I'm guessing there's some way to convert rand1 and rand2 into integers.
Here is the error I got.
Code:
#demonstrates user defined range of possible random numbers.
import random
print ("\t\t\tWelcome th the Random # Generator v2.0")
range1 = input ("\nPlease give the preffered minimum for the random number: ")
range2 = input ("Please give the preffered maximum for the random number: ")
num = random.rand (range1, range2)
print ("Your number is ", num)
Code:
Traceback (most recent call last):
File "C:/Python32/programs/usedDEFrand.py", line 9, in <module>
num = random.rand (range1, range2)
AttributeError: 'module' object has no attribute 'rand'
Comment