Your question is Repeated Words and Recursion. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Nykaa search and review text may contain inconsistent capitalization and punctuation. Given a sentence, return the words that occur more than once, along with the sentence reversed character by character using recursion.
Treat words case-insensitively. A word is a consecutive sequence of letters or digits, and punctuation does not belong to a word. Preserve the original sentence exactly when producing the reversed string, including spaces and punctuation.
Implement analyze_sentence(sentence), where sentence is a string. Return a dictionary with:
repeated_words: a dictionary mapping each repeated lowercase word to its occurrence count. Include only words with a count greater than one.reversed: the original sentence reversed character by character, produced by a recursive helper.The order of entries in repeated_words does not affect correctness.
def analyze_sentence(sentence):