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](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3c528b68dd_75266f3c52835862.jpg)
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
Get step-by-step solutions from verified subject matter experts
