Program - Choose given number of elements from the list with different probability


Topic: Program - Choose given number of elements from the list with different probability

Solution

import random
num1 =5
numberList = [111, 222, 333, 444, 555]
print(random.choices(numberList, weights=(10, 20, 30, 40, 50), k=num1))



List all Python Programs