Q. Given a string S, write expressions to print


(i) First five characters of S

(ii) Ninth character of S

(iii) Reversed S

(iv) Alternate characters from reversed S


Answer =

(i) S [ : 6]
(ii) S [ 9 : 10]
(iii) S [-1 : : -1]
(iv) S [len(S) : : -1 ]

1 Comments

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

Post a Comment

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

Previous Post Next Post