foo = "abcdefc" # Using find() foo.find('c') # Output: 2 foo.find('g') # Output: -1 # Using index() # foo.index() is like foo.find(), # But when the substring is not found, it raises an exception. foo.index('h') # ValueError: substring not found