Album total duration
Input
Album("Hits","DJ",[Track("One",120),Track("Two",150)]).total_duration()
Output
270
Two tracks of 120 and 150 seconds sum to 270.
Full lesson preview
Model a small media library using composition: tracks belong to albums, and albums belong to a library.
Problem statement
Task
Examples
Input
Album("Hits","DJ",[Track("One",120),Track("Two",150)]).total_duration()
Output
270
Two tracks of 120 and 150 seconds sum to 270.
Input format
Output format
Constraints
Samples
Input
MediaLibrary([Album("A","X",[Track("a",30)]),Album("B","Y",[Track("b",40),Track("c",50)])]).total_duration()
Output
120
Total duration is 30 + 40 + 50 = 120 seconds.