Files
curriculum/1.solar-system/3.strings/05.the-mirror/starter/starter.py

20 lines
591 B
Python

def mirror(s):
"""Detect if s is a palindrome and return a dict.
Keys:
"original" — s unchanged
"reversed" — s reversed
"palindrome" — True if s equals its reverse, False otherwise
Reverse a string with [::-1]:
"Hello"[::-1] -> "olleH"
mirror("racecar") -> {"original": "racecar",
"reversed": "racecar",
"palindrome": True}
mirror("hello") -> {"original": "hello",
"reversed": "olleh",
"palindrome": False}
"""
pass