Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. def mirror(text):
  2. mirrorPoint=(len(text)/2)
  3. for i in range(0,mirrorPoint):
  4. text=text[mirrorPoint]
  5. return text+''.join(string(text))
  6. print mirror('text')
  7.  
  8. def mirror(text):
  9. mirror_point = int(len(text)/2)
  10. res = text[:mirror_point] # Get Slice of Text
  11. return res + res[::-1] # Add Slice Plus Reverse of the Slice
  12. print mirror( 'abcd')
  13.  
  14. def mirror(text):
  15. res = ""
  16. mirrorPoint = int(len(text)/2)
  17. for i in range(mirrorPoint):
  18. res += text[i]
  19. return text[:mirrorPoint] + res[::-1]
  20.  
  21. def mirror(text):
  22. mirror_point = int(len(text) / 2)
  23. if mirror_point % 2 == 0:
  24. res = text[:mirror_point]
  25. else:
  26. res = text[:mirror_point+1]
  27. return res + res[::-1]
  28.  
  29. any_string[::-1]
  30.  
  31. my_string = "hello"
  32. middle_point = int(len(my_string/2))
  33. mirror_string = my_string[0:middle_point]+my_string[0:middle_point][::-1]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement