jeudi 27 avril 2023

How do I have the random.randint give a different output when its given the same numbers in the list for each time the define is used

I'm trying to make a list where each time a random item from the list is chosen it gives the number to the define of lwr() that makes it a random radiant. I was hoping there would be a way of accomplishing this while still using the define lwr() to give the random radiant. Though I cant get the random radiant to change each time when the same list item is given

import random

def lwr(start,end):
    y = ((random.randint(start,end)))
    return y

list =[lwr(1,10)]

print(random.choice(list))
print(random.choice(list))
print(random.choice(list))

Current Output(example): 4 4 4

Desired Output(example): 6 3 7

​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​




Aucun commentaire:

Enregistrer un commentaire