In this exercise, you are implementing a way to keep track of the high scores for the most popular game in your local arcade hall.
You have 5 functions to implement, mostly related to manipulating an object that holds high scores.
Create a function create_score_board that returns a dict that serves as a high score board.
The keys of this object will be the names of the players, the values will be their scores.
For testing purposes, you want to directly include one entry in the object.
This initial entry should consist of "The Best Ever" as player name and 1_000_000 as score.
create_score_board()
// returns an object with one initial entryTo add a player to the high score board, define the function add_player.
It accepts 3 parameters:
The function returns a dict with the new player and score added.
If players violate the rules of the arcade hall, they are manually removed from the high score board.
Define remove_player which takes 2 parameters:
This function should return the dict without the player that was removed.
If the player was not on the board in the first place, nothing should happen to the board, it should be returned as is.
If a player finishes another game at the arcade hall, a certain amount of points will be added to the previous score on the board.
Implement update_score, which takes 3 parameters:
The function should return a dict with the updated score.
If the player was not on the board in the first place, nothing should happen to the board, it should be returned as is.
The arcade hall keeps a separate score board on Mondays. At the end of the day, each player on that board gets 100 additional points.
Implement the function apply_monday_bonus that accepts a score board.
The function returns a dict with the bonus points added for each player that is listed on that board.
In this exercise, you are implementing a way to keep track of the high scores for the most popular game in your local arcade hall.
You have 5 functions to implement, mostly related to manipulating an object that holds high scores.
Create a function create_score_board that returns a dict that serves as a high score board.
The keys of this object will be the names of the players, the values will be their scores.
For testing purposes, you want to directly include one entry in the object.
This initial entry should consist of "The Best Ever" as player name and 1_000_000 as score.
create_score_board()
// returns an object with one initial entryTo add a player to the high score board, define the function add_player.
It accepts 3 parameters:
The function returns a dict with the new player and score added.
If players violate the rules of the arcade hall, they are manually removed from the high score board.
Define remove_player which takes 2 parameters:
This function should return the dict without the player that was removed.
If the player was not on the board in the first place, nothing should happen to the board, it should be returned as is.
If a player finishes another game at the arcade hall, a certain amount of points will be added to the previous score on the board.
Implement update_score, which takes 3 parameters:
The function should return a dict with the updated score.
If the player was not on the board in the first place, nothing should happen to the board, it should be returned as is.
The arcade hall keeps a separate score board on Mondays. At the end of the day, each player on that board gets 100 additional points.
Implement the function apply_monday_bonus that accepts a score board.
The function returns a dict with the bonus points added for each player that is listed on that board.