Python Fundamentals ยท Collections
Take parts of a list with [start:stop:step], reverse it, and copy it so changes do not leak back.
days = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]
weekdays = days[:5] # from the start up to index 5
weekend = days[5:] # from index 5 to the end
every_other = days[::2] # step 2
backwards = days[::-1] # step -1 reverses
copy = days[:] # a new list with the same items
copy[0] = "MON"
print(weekdays, weekend, every_other, backwards, days[0], copy[0])days is created and points to a new list: ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'].[:] slices everything: a new list with the same items.