May-10-2019, 05:58 PM
Project Objective:
Make 5 random selections from a list of 25 items with no dultiples or numbers used more than one time.
Tried:
Make 5 random selections from a list of 25 items with no dultiples or numbers used more than one time.
Tried:
from random import sample list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25] Chosennumber = sample(list, 5) print("sampling with choices method ", Chosennumber) Chosennumber = sample(list, 5) print("sampling with choices method ", Chosennumber) Chosennumber = sample(list, 5) print("sampling with choices method ", Chosennumber) Chosennumber = sample(list, 5) print("sampling with choices method ", Chosennumber) Chosennumber = sample(list, 5) print("sampling with choices method ", Chosennumber)and
import random #sampling with replacement list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25] #for list in list: sampling = random.choices(list, k=5) print("sampling with choices method ", sampling) sampling = random.choices(list, k=5) print("sampling with choices method ", sampling) sampling = random.choices(list, k=5) print("sampling with choices method ", sampling) sampling = random.choices(list, k=5) print("sampling with choices method ", sampling) sampling = random.choices(list, k=5) print("sampling with choices method ", sampling)