A slice can be taken from a string or list, just as you can take a slice from a pizza.
Python starts numbering of string and list elements from zero.

Slice Example:

persons = [ "John", "Marissa", "Pete", "Dayton" ]

slice = persons[0:2]

Study drill

Try the exercises below

1. Take a slice of the list below:
pizzas = [“Hawai”,”Pepperoni”,”Fromaggi”,”Napolitana”,”Diavoli”]

2. Given the text “Hello World”, take the slice “World”

After completing these continue with the next exercise.

Exercise 13: Nested loops
Multiple return