Skip to content

Instantly share code, notes, and snippets.

@gowrishankarin
Last active August 13, 2021 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gowrishankarin/24572354f5b8a85a49e3c2162be30d6e to your computer and use it in GitHub Desktop.
Save gowrishankarin/24572354f5b8a85a49e3c2162be30d6e to your computer and use it in GitHub Desktop.
Jaddu Rocks
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')
@gowrishankarin
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment