I'm trying to create a code that produces a list of 5 different random number. Here is my current code:
import random
rN0 = random.randint(1, 50)
rN1 = random.randint(1, 50)
rN2 = random.randint(1, 50)
rN3 = random.randint(1, 50)
rN4 = random.randint(1, 50)
randomNumber = [rN0, rN1, rN2, rN3, rN4]
But, sometimes it produces two or more of the same number in the list. I would like each number in the list to be unique every time. Help please?
Aucun commentaire:
Enregistrer un commentaire