I have lists a
and b
a = [0.1, 0.3, 0.1, 0.2, 0.1, 0.1, 0.1]
b = [apple, gun, pizza, sword, pasta, chicken, elephant]
Now I want to create a new list c of 3 items
the 3 items are chosen form list b based on the probabilities in list a
the items should not repeat in list c
for example- output I am looking for
c = [gun,sword,pizza]
or
c = [apple, pizza, pasta]
note (sum of all values of list a is 1,number of items in list a and b is the same, actually i have a thousand items in both list a and b and i want to select hundred items from the list based on probability assigned to them,python3 )