What is the output of print('python'.find('z')) in Python?
print('python'.find('z'))
Correct answer
A. -1
5 views
A. -1
5 views
find() returns -1 when the substring is not found; index() would raise ValueError.
Asked in: Python Interview Strings
https://docs.python.org/3/library/stdtypes.html#string-methodsNot sure why the answer is A? Ask here and get an explanation.