You are viewing a single comment's thread. Return to all comments →
from itertools import combinations n = int(input()) eng_list = input().split() k = int(input()) index_a = [i+1 for i,j in enumerate(eng_list)if j=='a'] comb = list(combinations(range(1,len(eng_list)+1), k)) count = 0 for j in comb: if any(i in j for i in index_a): count+=1 prob = count/len(comb) print(round(prob,11))
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 →