Python Testing & Debugging|
Fix the IndexError

Index and Attribute Errors

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.

Code Editor
Loading PYTHON engine...
Loading...
Loading Python engine...

Run your code to see output