You are viewing a single comment's thread. Return to all comments →
import itertools N = int(input()) cases = list(input().split()) K = int(input()) all_combinations = list(itertools.combinations(cases, K)) valid_combinations = [combo for combo in all_combinations if 'a' in combo] prob_consist_a = len(valid_combinations) / len(all_combinations) print(prob_consist_a)
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 →