```py def getlength(str:str)-> int: """Get the length of a string.""" i = 0 while True: try: str[i] except IndexError: return i - 1 finally: i += 1 ``` i know that len() is a function, i just decided to recreate it.
you can also create a len function for your custom classes!