Computer Science
What is the output produced?
(i) >>> "whenever" .find("never")
(ii) >>> "whenever" .find("what")
Python String Manipulation
8 Likes
Answer
(i) 3
The starting index of substring "never" in "whenever" is 3.
(ii) -1
Substring "what" is not present in "whenever".
Answered By
5 Likes
Related Questions
Find the errors. Find the line numbers causing errors.
- S = "PURA VIDA"
- S1 = S * 2
- S2 = S1[-19] + S1[-20]
- S3 = S1[-19 :]
Find the errors. Find the line numbers causing errors.
- S = "PURA VIDA"
- S1 = S[: 5]
- S2 = S[5 :]
- S3 = S1 * S2
- S4 = S2 + '3'
- S5 = S1 + 3
What is the output produced?
(i) >>> "-".join(['123','365','1319'])
(ii) >>> " ".join(['Python', 'is', 'fun'])
Given a string S, write expressions to print
- first five characters of S
- Ninth character of S
- reversed S
- alternate characters from reversed S