I'm trying to generate x random numbers based on lists I will provide (containing the same amount of numbers I want generated). So Far I have this code:
import random
list = []
while len(list) < 10:
x = random.randint(1, 100)
if x not in list:
list.append(x)
list.sort()
print (list)
The question is, how do I input the lists I have so Python can read some pattern (in lack of a better word) and generate numbers? Tried Google it, found nothing so far. Thanks.
Aucun commentaire:
Enregistrer un commentaire