The method find
shall be used only if you are interested in the position of the occurrence in string, that is, to know in which part of string the desired value was found. If the intention is only to check if it is found, the ideal is to use the operator in
:
texto = input()
if "exemplo" in texto:
print("Encontrou")
See working on Ideone | Repl.it
Remember that in Python 3, the return of the function input
is already a string, then there is no need to convert it again.
If it is really interesting to know in which position the desired value occurred, it is possible to do something like:
texto = input()
index = texto.find("exemplo")
if index >= 0:
print("Encontrou na posição %d" % index)
See working on Ideone | Repl.it
So we can help you, provide a Minimum, Complete and Verifiable code.
– NoobSaibot