05Last Item

    Very easylistsindexing

    Write last_item(items) that returns the last element of the list items.

    If the list is empty, return None instead of crashing.

    Examples

    Example 1
    >>> last_item([1, 2, 3])
    3
    Example 2
    >>> last_item([])
    None

    Run examples checks the 2 examples above. Submit runs all 5 tests, including hidden edge cases, and marks the challenge solved.

    solution.py
    Loading Python…

    Test results show up here

    Write last_item in the editor, then run the examples. Use print() freely: its output is shown for each test.