Halloween Sale: Flat 70% + Addl. 25% Off + 30 Days Extra Lab on all Courses | Use Coupon HS25 in Checkout | Offer Expires InEnroll Now
A segment of a string is called a slice.
s = "cloudxlab" print(s[1:5])
It prints the segment starting from the character with index
1 to index
'loud'. Therefore, it includes the 1st i.e.
1 and excludes the last i.e.
If the 1st index is greater or equal to the 2nd index, it returns an empty string enclosed in the quotation,
''. This is also a string with length 0.
We can also use
negative indices to get some character from the string.
Negative indices count backward from the last. To access the
last character we can write,
For second last character,
slicing_functhat takes an argument (assume string)
No hints are availble for this assesment
Answer is not availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here