Make a dart competition result program. Each competitor will record one result per competition in the system. The name of the competitor and the result achieved are recorded in the result. The results...

Make a dart competition result program. Each competitor will record one result per competition in the system. The name of the competitor and the result achieved are recorded in the result. The results of the competition can be saved in a competition-specific file. Each competition has a name and the results of the competition. The results of old competitions can be re-applied for review.
The program has the ability to reset the competition, add competition results, print the competition results, save the competition results to a file, download the results of the old competition from a file and terminate the program. The program must be stored in the file solution.py and must contain at least the following variables:competition: dictionary - results container (initializing competition = {})name: string - the name of the competition, which also determines the name of the deposit file with the extension .txt (initialize name = "")selection: string - action selection in the interface (initialize selection = "" first)
and functions:addResult - add the result to the competition dictionarycall parameters:competition: dictionary - competition result tankcompetitor: string - the name of the competitorresult: string - the result of the competitor as a string of numbersreturn parameters:nothingprintCompetition - prints the competition results to the consolecall parameters:name: string - the name of the competition (unique identifier, must not contain spaces, as it forms the name of the file)competition: dictionary - competition result tankreturn parameters:nothingsaveCompetition - saves the competition results to a filecall parameters:name: string - the name of the competition (unique identifier, must not contain spaces, as it forms the name of the file)competition: dictionary - competition result tankreturn parameters:bool - save success information (True - successful, False - failed)downloadCompetition - downloads from the old contest file XXXXXXXXXXcall parameters:name: string - the name of the competition (unique identifier, must not contain spaces, as it forms the name of the file)competition: dictionary - competition result tankreturn parameters:bool - load success information (True - successful, False - failed)
In competition dictionary, the key is the competitor and the value is the result.
Note that the contest name must not have a .txt extension. The plugin needs to be added in the downloadCompetition and saveContest functions.
The program's interface has the following command prompt"Enter a selection (n - start new, l - load old, s - save, p - results, i - add, q - stop):"whose selections have the following functions (stored in the variable selection):n: prompts for the contest name with the command "Enter contest name:" and resets the result container (contest = {})l: asks for the name of the competition to be downloaded and uploads the results of the old competition from the file to the results container ( .txt)s: saves the competition results in a file ( .txt) line by line in the format , p: prints the competition name in the format Competition: and the results for the console line by line in the format i: reads the name and result of the contestant from two lines with the command prompts "Enter competitor:" and "Enter result:"the reading is repeated until the competitor is named enter onlyif the competition has not yet been given a name, the competition name will be asked with the command "Enter competition name:"q: Stops the program without printing anything
May 03, 2021

Submit New Assignment

Copy and Paste Your Assignment Here