Slicing Lab

Goal

Get the basics of sequence slicing down

Tasks

Write some functions that:

  • return a sequence with the first and last items exchanged.
  • return a sequence with every other item removed
  • return a sequence with the first and last 4 items removed, and every other item in between
  • return a sequence reversed (just with slicing)
  • return a sequence with the middle third, then last third, then the first third in the new order

NOTE: these should work with ANY sequence – but you can use strings to test, if you like.