We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
# Enter your code here. Read input from STDIN. Print output to STDOUTimportitertoolsN=int(input())cases=list(input().split())K=int(input())all_combinations=list(itertools.combinations(cases,K))valid_combinations=[comboforcomboinall_combinationsif'a'incombo]prob_consist_a=len(valid_combinations)/len(all_combinations)print(prob_consist_a)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Iterables and Iterators
You are viewing a single comment's thread. Return to all comments →