v Select Random Item From A Lists - Python

Select Random Item From A Lists

Interesting in learning more? Check out Fluent Python

Preliminaries

from random import choice

Create List

# Make a list of crew members
crew_members = ['Steve', 'Stacy', 'Miller', 'Chris', 'Bill', 'Jack']

Select Random Item From List

# Choose a random crew member
choice(crew_members)
'Stacy'