Last active
August 13, 2021 14:37
-
-
Save gowrishankarin/24572354f5b8a85a49e3c2162be30d6e to your computer and use it in GitHub Desktop.
Jaddu Rocks
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
scores = ["81", "58", "1*", "16", "30*", "40", "91", "51", "60*", | |
"12", "9", "16*", "57", "28*", "15", "16", "56", "40"] | |
notouts = [ | |
1 if a_score.find("*") != -1 else 0 for a_score in scores | |
] | |
outs = (len(scores) - sum(notouts)) | |
total_score = sum([ | |
int(score.split("*")[0]) if is_out else int(score) for score, is_out in zip(scores, notouts) | |
]) | |
print(f'Jaddu\'s Average in the last {len(scores)} innings is {total_score/outs}') | |
print(f'He scored {total_score} runs and not out in {sum(notouts)} innings,') | |
print(f'that is {sum(notouts)/len(scores)*100}% opponents failed to take his wicket') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Jaddu's Average in the last 18 innings is 52.07692307692308
He scored 677 runs and not out in 5 innings,
that is 27.77777777777778% opponents failed to take his wicket