How to fix IndexError: string index out of range in Python | DevErrors