Iterables and Iterators

  • + 0 comments
    from itertools import combinations
    N = int(input())
    A = list(input().split())
    K = int(input())
    B = list(combinations(A, K))
    count = sum(1 for x in B if 'a' in x)
    print(count/len(B))