How do I select a random element from an array in Python?
Question:
The first examples that I googled didn’t work. This should be trivial, right?
Answers:
import random
random.choice([1, 2, 3])
import random
random.choice (mylist)
The first examples that I googled didn’t work. This should be trivial, right?
import random
random.choice([1, 2, 3])
import random
random.choice (mylist)