Visa Inc. interview question

implement slice function from python