Answers for "sampling python from list"

0

sampling python from list

# Python3 program to demonstrate
# the use of sample() function .
  
# import random 
from random import sample
  
# Prints list of random items of given length
list1 = [1, 2, 3, 4, 5] 
#format: sample(the_list,number_of_samples)  
print(sample(list1,3))
Posted by: Guest on May-26-2021

Code answers related to "sampling python from list"

Python Answers by Framework

Browse Popular Code Answers by Language