how to get random number from list in python code example

Example 1: how to print a random part of a list in python

import random

foo = ['a', 'b', 'c', 'd', 'e']
print(random.choice(foo))

Example 2: print random string from list python

import random

list = ["Item 1", "Item 2", "Item 3"]			# List
item = random.choice(list)						# Chooses from list
print(item)					# Prints choice

# From stackoverflow
# Tried and tested method

Example 3: python random generator from list

import random
n = random.random()
print(n)