Q. Find the output of the following:
word = 'work hard'
result = word.find('work')
print("Substring, 'work', found at index:", result )
result = word.find('har')
print("Substring, 'har, found at index:", result)
if (word.find('pawan') != -1):
print("Contains given substring")
else:
print("Doesn't contain given substring")
Answer :-
Substring, 'work', found at index: 0
Substring, 'har, found at index: 5
Doesn't contain given substring
>>>
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )