Q. In a string slice, the start and end values can be beyond limits. Why?
Answer =
Python will consider the limits of the string i.e., for missing begin-index, it will consider 0 (the first index) and for missing last value, it will consider length of the string.
Example -
>>> a = "Path Walla"
>>>a[ :7 ]
Path w
>>> a [3:]
h Walla
In string slice the start and ending of values can be beyond limits why
ReplyDeleteSkip either of the begin-index or last, Python will consider the limits of the string i.e., for missing begin-index, it will consider 0 (the first index) and for missing last value, it will consider length of the string.
DeleteBecause of you
ReplyDelete: )
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )