Q. What is a string slice? If a = "blueberry" evaluates the following:


(a) a[2:3]
(b) a[2:]
(c) a[:3]
(d) a[:]
(e) a[-1:-3]
(f) a[:-1]
(g) a[1:1]

Answer :-

String Slice refers to part of a string containing some contiguous characters from the string

(a) u
(b) ueberry
(c) blu
(d) blueberry
(e) It will not give any output because limiting value is smaller than starting value.
(f) blueberr
(g) It will not give any output because limiting value and staring value is same.

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post