Created
March 7, 2017 23:43
-
-
Save rjshekar90/632ca47596224960391484e866479781 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import combinations | |
b=int(input()) | |
a=input().split() | |
c=int(input()) | |
a=''.join(sorted(a)) | |
a_count=0 | |
for i in combinations(a,c): | |
if 'a' in i:a_count+=1 | |
print ("%0.3f" %(a_count/len(list(combinations(a,c))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment