Skip to content

Instantly share code, notes, and snippets.

@balapriyac
Created March 12, 2023 05:54
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 balapriyac/7b6771ec773d22258dc92056a95693eb to your computer and use it in GitHub Desktop.
Save balapriyac/7b6771ec773d22258dc92056a95693eb to your computer and use it in GitHub Desktop.
max_discount = 50
discount = 20
assert discount <= max_discount
def get_final_score(score,bonus,max_score):
if bonus:
score += 10
if score > max_score:
return max_score
return score
final_score = get_final_score(<some-score>,<bonus>,<max_score>)
assert final_score <= max_score,f"final_score should be at most {max_score}; got {final_score}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment