Kodewick
Start learning →
Starter←→0 / 80

Playlist track

#049StarterErrorsLists3 min

Press a number on the speaker and it plays that track of the playlist, counting from 1. Write song_at(playlist, n) to return the title of track n; if the playlist is not that long, return None. n is at least 1.

Examples
song_at(["Intro", "Rain", "Home"], 2)→'Rain'
song_at(["Intro"], 3)→None
main.py
def song_at(playlist, n):
    try:
        # your code here: return track n (lists count from 0)
        pass
    except IndexError:
        return None
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.