python_string_functions
python_string_functions
12. index() - Returns the index of the first occurrence of a substring (raises an error if not found).
print("hello world".index("world")) # Output: 6
13. rindex() - Returns the index of the last occurrence of a substring (raises an error if not found).
print("hello world world".rindex("world")) # Output: 12
21. isalnum() - Checks if all characters are alphanumeric (letters and numbers only).
print("hello123".isalnum()) # Output: True