vendredi 6 août 2021

getting a unique number using random module in python

suppose their is a while loop running 6 times. it gives a random number in a range of 1 to 10 each time. i want that all the 6 times two adjacent number should not be equal.

means output should look like 4, 5, 10, 6, 1, 6 where all adjacent number are different

not like this 4, 4, 5, 10, 1 because first two adjacent number are samethis is my code




Aucun commentaire:

Enregistrer un commentaire