I want to create a list containing three items randomly chosen from a list of many items. This is how I have done it, but I feel like there is probably a more efficient (zen) way to do it with python.
import random
words = ['bacon', 'gorilla', 'phone', 'hamburger', 'mother']
small_list = []
while len(small_list) < 4:
word = random.choice(words)
if word not in small_list:
small_list.append(word)
Expected output would be something like:
small_list = ['phone', 'bacon', 'mother']