Computer Science
Given a string S, write expressions to print
- first five characters of S
- Ninth character of S
- reversed S
- alternate characters from reversed S
Python String Manipulation
19 Likes
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 = '')
Answered By
9 Likes
Related Questions
What is the output produced?
(i) >>> "whenever" .find("never")
(ii) >>> "whenever" .find("what")
What is the output produced?
(i) >>> "-".join(['123','365','1319'])
(ii) >>> " ".join(['Python', 'is', 'fun'])
Write a program to count the number of times a character occurs in the given string.
Write a program which replaces all vowels in the string with '*'.