seed: curriculum content
This commit is contained in:
19
1.solar-system/3.strings/05.the-mirror/starter/starter.py
Normal file
19
1.solar-system/3.strings/05.the-mirror/starter/starter.py
Normal file
@@ -0,0 +1,19 @@
|
||||
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
|
||||
Reference in New Issue
Block a user