Practice: Slices
Contents
Practice: Slices#
For all the following questions, assume we are using the string
s = 'I have eaten the plums that were in the icebox'
For this checkpoint, you should do these by hand and not type the lines into a computer.
Please write your answers without surrounding quotes. This means if the substring returns would have been the string 'have eaten'
, you should write:
have eaten
Make sure you get the casing/spacing right!
Question 0#
What is the value of the following slice?
s[3:10]
Your Task
Write your answer down in your own space.
Question 1#
What is the value of the following slice?
s[s.find('p'):]
Your Task
Write your answer down in your own space.
Question 2#
What is the value of the following slice?
s[:s.find('t'):3]
Your Task
Write your answer down in your own space.