Title: Select Random Item From A Lists
Slug: select_random_item_from_list
Summary: Select Random Item From A Lists in Python.
Date: 2016-01-23 12:00
Category: Python
Tags: Basics
Authors: Chris Albon
Interesting in learning more? Check out Fluent Python
In [1]:
from random import choice
In [2]:
# Make a list of crew members
crew_members = ['Steve', 'Stacy', 'Miller', 'Chris', 'Bill', 'Jack']
In [3]:
# Choose a random crew member
choice(crew_members)
Out[3]: