GH avatar Bite 142. Exception Handling: Calculate the Winning Player

Complete the two functions below:

  • calculate_score takes a list of dice roll scores and returns the total score only taking into account scores of >= MIN_SCORE. If scores contains invalid data (!= DICE_VALUES) raise a ValueError.
  • get_winner uses this calculate_score helper to calculate the winning player from a list of Player namedtuples. However if the players passed in are not having the same number of scores (e.g. all have 4 scores) you should raise a ValueError too.

See the docstrings and pytest code for more info. Keep calm and code in Python, happy Cyber Monday!

Will you be Pythonista #26 to crack this Bite?
It takes an average of ~33 minutes to solve this Bite (submissions 5-240 min).
Pythonistas rate this Bite 2.0 on a 1-10 difficulty scale.
» You can do it! 😌

Login and get coding
We use Python 3.7