slice() function allows you to “slice” up a list and output a smaller number of items from it.
slice(list, number, number [optional]) list.slice(number, number [optional])
It accepts three arguments:
- The input list.
- A starting index, which is included in the output string (the start index of the input string is
- An ending index, which is optional and excluded from the output string.