python random values from list code example
Example 1: python list of random values
import random
randomlist = random.sample(range(10, 30), 5)
import numpy
random_float_array = numpy.random.uniform(75.5, 125.5, 2)
Example 2: how to print a random part of a list in python
import random
foo = ['a', 'b', 'c', 'd', 'e']
print(random.choice(foo))
Example 3: sample 1 item from array python
import random
cakes = ['lemon', 'strawberry', 'chocolate']
random.choice(cakes)
Example 4: python how to randomly choose an item from a list
import random
nums = ['a', 'b', 'c', 'd', 'e']
print(random.choice(nums))