mardi 9 juillet 2019

Python - Choose random name from array without repetition until all have been chosen

I've just started learning Python so if this is something easy i apologise. I want to generate a random name from a set array of names, then not repeat that name again until all have been chosen and the cycle begins again. The code below is what i have already, this generates the random name, but repetition is happening.

import random

employee = ["adam", "Scott", "Michael", "Andrew", "Mark", "Fernando", "Faith", "Steve", "Lee", "Amani", "Liv", "Nick A", "James", "Jake", "Brett", "Graham", "Fraser", "Jacob", "Chelsea", "Phil", "George", "Charley", "Emma", "Steph"]
print(random.choice(employee))




Aucun commentaire:

Enregistrer un commentaire