Skip to content

Instantly share code, notes, and snippets.

@RaMSFT
Last active October 10, 2022 15:09
Show Gist options
  • Select an option

  • Save RaMSFT/cfe78881c1e745deacd6f8909dcbcad9 to your computer and use it in GitHub Desktop.

Select an option

Save RaMSFT/cfe78881c1e745deacd6f8909dcbcad9 to your computer and use it in GitHub Desktop.
def calculate_points(wins, draws, losses):
"""calculate points for a football match based on wins, losses, and draws
Args:
wins (integer): number of wins
draws (integer): number of draws
losses (integer): number of losses
Returns:
_type_: _description_
"""
# number of points for wins: 3
# number of points for drwas: 1
# number of points for losses: 0
points = (3 * wins) + (1 * draws) + (0 * losses)
# don't necessarily need to put the last bit (0 * losses), it always results in 0
return points
print(calculate_points(3, 4, 2))
print(calculate_points(5, 0, 2))
print(calculate_points(0, 0, 1))
print(calculate_points(3, 9, 8))
print(calculate_points(1, 3, 2))
print(calculate_points(6, 9, 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment