Iterables and Iterators

  • + 0 comments
    from itertools import combinations
    
    _, lst, _indices = (int(input()), input().split(" "), int(input()))
    _lst = list(combinations(lst, _indices))
    freq = sum([ 1 if 'a' in list(item) else 0 for item in _lst])
    print(freq/len(_lst))