Question: [Python programe question] Hello , I am reading book introducing python on section 2 page 35. but I can't understanding the book write what mean

[Python programe question]

Hello , I am reading book "introducing python on section 2 page 35.

but I can't understanding the book write what mean is.

for exmaple:

bad offset mean [-50] in programe is mean[0]?

so the first line letter [-50:] ; in programe mean letter[0:]

I am confused for this page . Could every body help?

[Python programe question] Hello , I am reading book "introducing python on

Slices are more forgiving of bad offsets than are single-index lookups. A slice offset earlier than the beginning of a string is treated as 0, and one after the end is treated as -1, as is demonstrated in this next series of examples. From 50 before the end to the end: >letters[-50:] abcdefghi jkLnnopgrstuvwxyz From 51 before the end to 50 before the end: >letters[-51:-50] From the start to 69 after the start: letters[:70] abcdefghijklnnopqrstuvwxyz From 70 after the start to 70 after the start

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!