Split a number into equal parts given the number of parts I want to split a song into multiple parts, given the song duration and number of parts.

My code achieves that, but it feels a little "stupid" and I would like to learn a more sophisticated - and shorter - way. Particularly, I feel that the marker variable is a little overkill. I would welcome any suggestions.    

song_duration = 20 # these two 
num_of_parts = 4   # are given

part_duration = song_duration / num_of_parts
parts = []
marker = 0

for _ in range(num_of_parts):
    part = [marker, marker + part_duration]
    marker += part_duration
    parts.append(part)

print(parts)

# parts is : [[0, 5.0], [5.0, 10.0], [10.0, 15.0], [15.0, 20.0]]
In general, building a list using a loop of the form


some_list = []
for …:
    some_list.append(…)



… would be better written using a list comprehension.

Each interval always has two elements: a start time and an end time.  These two-element lists would be better represented as tuples instead of lists.  (Tuples have a connotation that they have a fixed length, whereas lists can grow to arbitrary lengths.)

Finally, I'd package the code into a function.

def intervals(parts, duration):
    part_duration = duration / parts
    return [(i * part_duration, (i + 1) * part_duration) for i in range(parts)]