import random
#1.A single element
random.choice(list)
#2.Multiple elements with replacement
random.choices(list, k = 4)
#3.Multiple elements without replacement
random.sample(list, 4)
import random
sequence = [i for i in range(20)]
subset = random.sample(sequence, 5) #5 is the lenth of the sample
print(subset) # prints 5 random numbers from sequence (without replacement)
import random
list = [20, 30, 40, 50 ,60, 70, 80]
sampling = random.choices(list, k=4) # Choices with repetition
sampling = random.sample(list, k=4) # Choices without repetition
import random
choose = ["Egg","Rat","Rabbit","Frog","Human"]
Choosen = random.choice(choose)
print(Choosen)
import random
numberList = [1,2,3,4,5]
print(random.choice(numberList)) # Prints a random number from the list