Kodewick
Start learning →
Starter←→0 / 80

Backwards note

#064StarterRecursionStrings3 min

Your deskmate passes notes written backwards. Write backwards(text) with recursion: let backwards reverse the rest of the text, then put the first letter at the end. An empty string stays empty.

Examples
backwards("abc")→'cba'
backwards("")→''
main.py
def backwards(text):
    if text == "":
        return ""
    # your code here: reverse the rest, then add the first letter (instead of return text)
    return text
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.