lundi 15 octobre 2018

How to generate a random number from a list of numbers, except of one random number of that list? [duplicate]

This question already has an answer here:

I want to generate a random number with the random function. After that I want to generate another random number from a list with numbers, but it can't take the other random number.

import random

x = random.randint(1,10)

y = random.randint(1,10) #except of x

print(x)

print(y)

possible output

5

7

but not

5

5




Aucun commentaire:

Enregistrer un commentaire