Iterables and Iterators

  • + 0 comments
    # Enter your code here. Read input from STDIN. Print output to STDOUT
    from itertools import combinations
    N=int(input())
    li=list(map(str,input().split(" ")))
    K=int(input())
    
    comb=list(combinations(li,K))
    
    c=0
    for i in comb:
        if 'a' in i:
            c+=1
    print(float(c/len(comb)))