write the output of the following:
string="Hello Madam,I love Tutorials"
substring=''Madam"
if string.find(substring) !=–1:
print ("Python found the substring!")
else:
print ("Python did NOT find the substring!")
Answers
Answered by
3
Answer:
Python found the substring!
Explanation:
string.find(substring) returns -1 when substring is not found.
in given example substring is found so it
will return the lowest index of the substring which is not equal to -1
therefore the if condition is true and produces "python found substring" as the output
Similar questions
English,
6 months ago
Accountancy,
6 months ago
Math,
6 months ago
Math,
1 year ago
Psychology,
1 year ago