Python

Fix the IndexError

IndexError

An IndexError occurs when accessing a list index that doesn't exist.

Your Task

Fix get_last_n_items to handle cases where n > length of list.

script.py
Loading PYTHON engine...
Downloading Python… (one-time, ~10 MB)

Downloading Python… (one-time, ~10 MB)

This runs entirely in your browser and is cached for next time.