Iterables and Iterators

  • + 0 comments

    Enter your code here. Read input from STDIN. Print output to STDOUT

    import itertools N = int(input()) letters = input().split() k = int(input()) listed_combinations = list(itertools.combinations(letters,k))

    count = 0

    for i in listed_combinations: if "a" in i: count +=1

    print(count/len(listed_combinations))