CBSE Class 11 Computer Science
Question 8 of 19
Strings in Python — Question 5
Back to all questionsPython found the substring!
The code checks if the substring "Madam" exists in the string "Hello Madam, I love Tutorials" using the find() method. Since "Madam" is present in the string, find() returns the starting index of "Madam", which is not -1. Therefore, the condition string.find(substring) != -1 evaluates to True, and the code prints "Python found the substring!".