0 of 6 problems solved • 0%

Exercise prompt

Take a Page

A slice that reaches beyond the end of a list returns the available items. That makes slices useful for a short last page.

Example

Select the two morning slots from this timetable.

slots = ["08:00", "09:00", "10:00", "11:00"] morning = slots[0:2] print(morning) # ['08:00', '09:00'] print(slots[3:8]) # ['11:00']

Python includes the start index and stops just before the end index. For a page, calculate that end index from the starting point and the requested length.

Your task

Return up to size names from names starting at the zero-based start index. Start and size are nonnegative integers. Return a new list.

page(["A", "B", "C"], 1, 4) # ["B", "C"]