You are viewing a single comment's thread. Return to all comments →
from itertools import combinations N = int(input()) N_list = input().split() K = int(input()) all_comb = list(combinations(N_list, K)) length = 0 for i in all_comb: if 'a' in i: length +=1 probability = length / len(all_comb) print(round(probability, 6))
Seems like cookies are disabled on this browser, please enable them to open this website
Iterables and Iterators
You are viewing a single comment's thread. Return to all comments →