APT: EatDrink

Specification

filename: EatDrink.py def winners(data): """ return String list based on String list data """ # you write code here

Problem Statement

Sometimes contests are based on speed, endurance, quality, or quantity and various combinations of these traits. It might be who can eat the most doughnuts, or who can quaff the most cans of a beverage, or who can solve the most APTs, or who can run the most consecutive sub 75-second 400 meter laps.

In this problem you'll be given data for a contest in which each contestant has performed some task in some number of minutes and seconds. The data will be given for all the tasks in the format "name time" where name is separated from time by one space. The time is in the format "min:sec" and represents how long it took someone to complete the task. The input data is a list of tasks done in the contest, each string in data represents one task.

Return a list of contestant names in rank order from winner to loser. The winningest contestant has performed the most tasks, or if there is a tie with another contestant in number of tasks, has performed the tasks most quickly. No contestant will have performed the same number of tasks in the same time as any other contestant. See the examples for details.

Constraints

Examples

  1. data = ["owen 2:00", "jeff 1:29", "owen 1:00", "jeff 1:30", "robert 0:21"]
    
    Returns ["jeff", "owen", "robert"]
    
    
    jeff and owen have each performed two tasks compared to robert's one task. owen's total time is 3 minutes, jeff's is 2 minutes and 59 seconds, so jeff is the winner of the contest.

  2. data = ["tyson 0:11", "usain 0:12", "carl 0:30", "carl 0:20", "usain 0:40", "carl 1:00"]
    
    Returns ["carl", "usain", "tyson"]
    
    
    carl performed three tasks, usain two tasks, and tyson one task.

  3. data = ["tyson 0:11", "usain 0:12", "carl 0:30", "carl 0:20", "usain 0:40", "carl 1:00" "usain 0:57"]
    
    Returns ["usain", "carl", "tyson"]
    
    
    Like the previous example, but usain has peformed one more task--his three tasks completed in in 57+12+40 seconds or 1:49, while carl's three tasks were completed in 1:50.

  4. data = ["kate 4:16", "kate 4:17"]
    
    returns ["kate"]