Question: Exercise 8 . 3 . A string slice can take a third index that specifies the step size ; that is , the number of

Exercise 8.3. A string slice can take a third index that specifies the step size; that is, the number
of spaces between successive characters. A step size of 2 means every other character; 3 means every
third, etc.
www.dbooks.org
80 Chapter 8. Strings
>>> fruit = 'banana'
>>> fruit[0:5:2]
'bnn'
A step size of -1 goes through the word backwards, so the slice [::-1] generates a reversed string.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!