You are viewing a single comment's thread. Return to all comments →
from itertools import combinations n, lc_letters, k = int(input()), input().split(), int(input()) # length of list combi = list(combinations(lc_letters, k)) num_a_in_comb = 0 for comb in combi: if "a" in comb: num_a_in_comb += 1 print (num_a_in_comb/len(combi))
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 →