You are viewing a single comment's thread. Return to all comments →
My solution below:
from itertools import combinations N=int(input()) elems=input().split() nInd=int(input()) comb_lst=list(combinations(elems, nInd)) a_times=[1 if 'a' in elem else 0 for elem in comb_lst] print(sum(a_times)/len(comb_lst))
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 →
My solution below: