Could the parameters to the win_percentage function be changed to not include losses?

Question

In this exercise, the win_percentage() function is passed wins and losses. What other parameters could be passed instead of losses?

Answer

The function is intended to calculate the ratio of wins to games played. The losses parameter is only used to compute the total number of games played for the ratio calculation. If the function were re-written to take wins and games_played as the parameters, the calculation in the function would only need to perform the division for the ration (and multiple by 100) and not calculate the total number of games played first.

7 Likes

8 posts were split to a new topic: Where do I need parenthesis to make the win percentage work?