Write a function mirror(s) that takes as input a string s and returns a mirrored version of s that is twice the length of the original string. For example:
>>> mirror('bacon') result: 'baconnocab' >>> mirror('XYZ') result: 'XYZZYX'
Hint: Use skip-slicing!
def mirror(myStr):
#appening origianl string with reversed string will give mirro string
#sliing with -1 will give the reverse of string
return myStr+myStr[::-1]
print(mirror("bacon"))
print(mirror("XYZ"))
Note : Please follow the screen shot for the Indentation of the code
Note : If you like my answer please rate and help me it is very Imp for me
Get Answers For Free
Most questions answered within 1 hours.