+ 1

# Choosing a random number from a range specified by a variable

Hello, I am trying to make a system that generates a certain amount of random numbers out of a certain range. The amount and the range are specified by a user something like this but it isn't working. a = float(input('Amount of numbers = ')) x = float(input('Minimum = ')) y = float(input('Maximum = ')) import random for g in range(a): print(random.randint(x, y)) Can someone please take a look and let me know what my error is? Thank you so much

2 Answers

+ 1

I think the paramater of the range should be an integer and not a float. If you change the type of the variable "a" to int it should work.

+ 1

thank you. it works now