vendredi 24 mars 2017

How do I generate a random integer between 1and a variable, or two variables in python? [duplicate]

This question already has an answer here:

I'm trying to generate a random integer between a specified minimum and maximum.

maxlength = input("Maximum length? \n >")
minlength = input("Minimum length? \n >")
import random
length = random.randint(minlength,maxlength) #this line does not work, says the arguments need to be integers
print (length)

Any ideas what I can do?




Aucun commentaire:

Enregistrer un commentaire