empty.txt is empty game1.txt Attackers,1,0,Eliminated… empty.txt is empty game1.txtAttackers,1,0,EliminatedDefenders,0,3,DefusedDefenders,1,2,Defusedgame2.txtDefenders,0,3,DefusedDefenders,1,2,DefusedAttackers,1,0,EliminatedDefenders,2,3,EliminatedDefenders,4,2,EliminatedAttackers,1,0,EliminatedDefenders,5,1,DefusedDefenders,10,3,DefusedAttackers,0,0,EliminatedQuestion 6.1:VALORANT is a tactical shooter game where a single match contains multiple rounds between two teams. Given a match information file that contains information on each round (same file format as Question 5!), parse it and return the data as a dictionary.The input file format for each row:Winning Team,#of Surviving Attackers,#of Surviving Defenders,Round TypeExample of an input file:Attackers,1,0,EliminatedDefenders,0,3,DefusedDefenders,1,2,DefusedEach line of the file represents a single round’s information. It contains information on what team won the round, the number of surviving members for each respective team, and the round win type. The information on each line is separated by commas.Write a function that takes a file of the format given above and returns the dictionary. The output dictionary should have two keys: ‘Attackers’ and ‘Defenders’. The respective values for each key should be a list of tuples, where each tuple is in the format of:(#of surviving members of the winning team, round type)For a single row, only the winning team should have a tuple added to their list in the dictionary.Example (using input from above):Input fileWinning Team (key)# of surviving members ofwinning teamRound TypeTuple in output value listAttackers,1,0,EliminatedDefenders,0,3,DefusedDefenders,1,2,Defused’Attackers”Defenders”Defenders’132’Eliminated”Defused”Defused'(1, ‘Eliminated’)(3, ‘Defused’)(2, ‘Defused’)Output dictionary:{‘Attackers’: [(1, ‘Eliminated’)], ‘Defenders’: [(3, ‘Defused’), (2, ‘Defused’)]}Note that the number of surviving members should be an integer.For each team, their list of tuples should be in the order in which they first appear in the file (starting from the top).’Attackers’ should always be the first key in the dictionary, with ‘Defenders’ following it. You can assume that the file will only contain ‘Attackers’ or ‘Defenders’ as the team.If the file is empty a dictionary should still be returned with the keys ‘Attackers’ and ‘Defenders’, with their values being empty lists.Hint: Try defining the dictionary for the empty file case first, so then you don’t need to worry about the keys/value lists not existing when trying to add the tuples into the dictionary.Hint: When reading in the file, approach it line-by-line. Remember that order of the elements in each line will be consistent and be separated by commas. Thestr.split() function may be useful here. Additionally, thestr.strip() function may be useful to get rid of any unneeded characters.defparse_match(filepath): “””>>> parse_match(‘files/game1.txt’){‘Attackers’: [(1, ‘Eliminated’)], ‘Defenders’: [(3, ‘Defused’), (2, ‘Defused’)]}>>> parse_match(‘files/empty.txt’){‘Attackers’: [], ‘Defenders’: []}>>> parse_match(‘files/game2.txt’){‘Attackers’: [(1, ‘Eliminated’), (1, ‘Eliminated’), (0, ‘Eliminated’)], ‘Defenders’: [(3, ‘Defused’), (2, ‘Defused’), (3, ‘Eliminated’), (2, ‘Eliminated’), (1, ‘Defused’), (3, ‘Defused’)]}”””Question 6.2:Using the parsed match information dictionary that we obtained from the previous function (passed in asdata), return a list of two tuples containing information on the total number of surviving members on each team for a givenround_type.For example, if the round_type is ‘Eliminated’, sum the total number of surviving members of each team for each ‘Eliminated’ round type contained in the dictionary.Example:Inputdata:{‘Attackers’: [(1, ‘Eliminated’)], ‘Defenders’: [(3, ‘Defused’), (2, ‘Defused’)]}Inputround_type# of surviving Attackers# of surviving DefendersOutput’Eliminated’10[(‘Attackers’, 1), (‘Defenders’, 0)]’Defused’03+2 = 5[(‘Attackers’, 0), (‘Defenders’, 5)]’Nonexistent’00[(‘Attackers’, 0), (‘Defenders’, 0)]The list should have the Attackers tuple as its first element, with the Defenders tuple being the second element. Note that the input round_type may not exist in the given data.If the function call toparse_match returns a dictionary with an empty list as one of its values or if a team doesn’t have any entries for a given round type, the tuple should still be in the output with a value of 0 for the team.Example: [(‘Attackers’, 0), (‘Defenders’, 0)]defcount_members(data, round_type): “””>>> data1 = parse_match(‘files/game1.txt’)>>> count_members(data1, ‘Eliminated’)[(‘Attackers’, 1), (‘Defenders’, 0)]>>> count_members(data1, ‘Defused’)[(‘Attackers’, 0), (‘Defenders’, 5)]>>> count_members(data1, ‘Nonexistent’)[(‘Attackers’, 0), (‘Defenders’, 0)]”””Computer ScienceEngineering & TechnologyPython Programming DSC 20

Order your essay today and save 20% with the discount code ESSAYHELP