You are viewing a single comment's thread. Return to all comments →
from itertools import combinations # Input n = int(input()) letters = input().split() k = int(input()) combs = list(combinations(letters, k)) countwitha=sum([1 for comb in combs if "a" in comb]) ratio=countwitha/len(combs) print(f"{ratio:.3f}")
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 →