Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def mirror(text):
- mirrorPoint=(len(text)/2)
- for i in range(0,mirrorPoint):
- text=text[mirrorPoint]
- return text+''.join(string(text))
- print mirror('text')
- def mirror(text):
- mirror_point = int(len(text)/2)
- res = text[:mirror_point] # Get Slice of Text
- return res + res[::-1] # Add Slice Plus Reverse of the Slice
- print mirror( 'abcd')
- def mirror(text):
- res = ""
- mirrorPoint = int(len(text)/2)
- for i in range(mirrorPoint):
- res += text[i]
- return text[:mirrorPoint] + res[::-1]
- def mirror(text):
- mirror_point = int(len(text) / 2)
- if mirror_point % 2 == 0:
- res = text[:mirror_point]
- else:
- res = text[:mirror_point+1]
- return res + res[::-1]
- any_string[::-1]
- my_string = "hello"
- middle_point = int(len(my_string/2))
- mirror_string = my_string[0:middle_point]+my_string[0:middle_point][::-1]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement