1import random
2
3#1.A single element
4random.choice(list)
5
6#2.Multiple elements with replacement
7random.choices(list, k = 4)
8
9#3.Multiple elements without replacement
10random.sample(list, 4)
1import random
2names=['Mark', 'Sam', 'Henry']
3
4#Set any array
5random_array_item=random.choice(names)
6
7#Declare a variable as a random choice
8print(random_array_item)
9
10#Print the random choice
11#Or, if you want to arrange them in any order:
12for j in range(names):
13 print(random.choice(names))