Which of the following will give
"Simon" as output?
If str1="John, Simon, Aryan
print(str1[-7:-12])
print(str1[-11:-7])
print(str1[-11:-6))
print(str1(-7:-111)
Answers
Answered by
9
Answer:
print(str1[-11, -7])
Explanation:
Since the question here is asking the required output ‘Simon’ from the string in the reverse order, we know that index of the string from the last starts from -1 and counting in reverse we get the the index of the first alphabet of the word ‘Simon’ -11 and similarly we get the last index of the word as -7.
Answered by
0
Answer:
Ans C
Explanation:
Explanation: Slicing takes place at one index position less than the given second index position of the string. So,second index position will be -7+1=-6.
Source:- Letsfindcourse.com
Similar questions