Python Compiler
txt = "Python is simple, Python is great" x = txt.find("world") print(x) y = txt.index("world") print(y)
OUTPUT
-1
Traceback (most recent call last):
 File "file_name.py", line 6, in <module>
  y = txt.index("world")
ValueError: substring not found.
×

Save as Private