import random
global colours
global current
colours = ["Red","Yellow","Blue","Green","Orange","White"]
current = []
def randompicker():
for i in range(4):
current = random.choice(colours)
randompicker()
print(colours)
print(current)
Hey, so the above program is supposed to randomly add 4 of the elements from the list called colours into the other list named current. I have looked through the forums, but I cannot find help specific to this case.
In short, Is there a quick and efficient way to add 4 random elements from one list straight into another?
Thanks
Aucun commentaire:
Enregistrer un commentaire