random seleciton python code example
Example 1: sample 1 item from array python
import random
cakes = ['lemon', 'strawberry', 'chocolate']
random.choice(cakes)
# prints 1 randomly selected item from the collection of n items with
# the probability of selection as 1/n
Example 2: random.choice()
import random
l=[1,2,3,4,5,6,7,8,9,0]
random.choice(l)
print(l);