1. Engineering
  2. Computer Science
  3. please solve the following question by python3 code the function...

Question: please solve the following question by python3 code the function...

Question details

Please solve the following question by Python3.

Code the function calc_tot_playtime to calculate the total playtime by user and game.

Each element in input is of the format

"user_id, game_id, total_playtime_in_minute".

Input is a list of strings of the above format.

Output should be sorted by user_id, game_id in ascending order.

Example:

Input: ["1,10,20", "1,15,10m", "1,10,10m", "2,10,40m", "2, 20, 10m"]

output: [('1', '10', 30), ('1', '15', 10), ('2', '10', 40), ('2', '20', 10)]

Functions are defined below:

def calc_total_playtime(input_data=None):

"""

your code here

:param: input_data: input list of strings

return output of tuples

index 0 -user_id

index 1 - game_id

index 2- total play time in minutes

"""

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution