pastebin

Paste Search Dynamic
Recent pastes
reverse
  1. def reverse(s):
  2.         if len(s) == 0:
  3.                 return s
  4.         else:
  5.                 return reverse(s[1:]) + s[0]
  6.  
  7.  
  8. s = "PrepBytes"
  9.  
  10. print("The original string is : ", end="")
  11. print(s)
  12.  
  13. print("The reversed string(using recursion) is : ", end="")
  14. print(reverse(s))
  15.  
Parsed in 0.014 seconds