can you debug this code
direct_sentence = " I love programming, said Jane.It us so much fun." direct_to_indirect(direct_sentence) print(indirect_sentence) def direct_to_indirect(direct_sentence): """ Convert direct speech to indirect speech """ words = direct_sentence.split() indirect_sentence = [] for i in range(len(words)): word = words[i] if word in ["said", "told", "asked"]: indirect_sentence.append(word) indirect_sentence.append("that") elif i == 0: indirect_sentence.append(word.capitalize()) elif word.endswith(".") or word.endswith("?") or word.endswith("!"): indirect_sentence.append(word[:-1]) indirect_sentence.append(word[-1]) else: indirect_sentence.append(worhd) return " ".join(indirect_sentence)