Iterables and Iterators

  • + 0 comments
    from itertools import combinations
    
    N = int(input().strip())
    N_list = input().split()
    K = int(input().strip())
    
    all_comb = list(combinations(N_list, K))
    print(len([i for i in all_comb if 'a' in i])/len(all_comb))