import random
# Pick an item randomly chosen = random.choice([1, 2, 3])
# Print out the chosen item print(chosen)
2
The choice method can be used not only with Python lists, but also with other sequences such as tuples and strings.
Python Mega Course: Learn Python in 60 Days, Build 20 Apps
Learn Python on Udemy completely in 60 days or less by building 20 real-world applications from web development to data science.