Question

"banana".find('z') Out[22]: -1 why is this -1 python 3.7

"banana".find('z')
Out[22]: -1

why is this -1

python 3.7

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The find() method returns the lowest index of the substring if it is find in the string that is queried. If it is not found
-1 is returned


For example

in case of
"banana".find('a')
output will be 1 (because the lowest index of a is 1)
"banana".find('na')
output will be 2 (because lowest index starts at 2)
"banana".find('z')
output is -1 because there is no substring 'z' in "banana"



Thank you, please up vote

Add a comment
Know the answer?
Add Answer to:
"banana".find('z') Out[22]: -1 why is this -1 python 3.7
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT