A Track List You Can Read

Python for AIMedium+10 XP+10

A Track List You Can Read

A Track has a title and a length in seconds.

Part 1: add a __repr__ that shows the title, then the length in brackets as minutes:seconds. The seconds part always has two digits, so 65 seconds is 1:05, not 1:5.

Part 2: write track_list(pairs). pairs is a list of (title, seconds) tuples. Make a Track for each, put them in a list, and return str() of that list.

Examples

str(Track('Hum', 125))
returns 'Hum (2:05)'
pairs = [('Hum', 125), ('Buzz', 61)]
returns '[Hum (2:05), Buzz (1:01)]'
pairs = [("Intro", 65), ("Outro", 200)]
returns '[Intro (1:05), Outro (3:20)]'
str(Track("Short", 59))
returns 'Short (0:59)'

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run