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.
fromitertoolsimportcombinations#total possible outcomeN=int(input())#list of outcomesl=list(input().split())#desired outcomen=int(input())new=list(combinations(l,n))count=0#calculation for the probability of 'a' being in the strings givenforiinnew:if'a'ini:count+=1print(f"{count/len(new):.12f}")
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 →