CBSE Class 11 Computer Science
Question 76 of 91
String Manipulation — Question 21
Back to all questions 21
Question Question 11
Given a string S, write expressions to print
- first five characters of S
- Ninth character of S
- reversed S
- alternate characters from reversed S
Answer
- print(S[:5])
- print(S[8])
- for a in range(-1, (-len(S) - 1), -1) :
print(S[a], end = '') - for a in range(-1, (-len(S) - 1), -2) :
print(S[a], end = '')