Advertisement
ralphdc09

its103.md.wk.07.08.num01

Nov 11th, 2021
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.90 KB | None | 0 0
  1. # Ralph Custodio
  2. # BSIT II-A
  3.  
  4. # Create function for reversing a name string
  5. def name_reverse(name):
  6.     rev_name = ''
  7.     index = len(name)
  8.     while index > 0:
  9.         rev_name += name[index - 1]
  10.         index = index - 1
  11.     return rev_name
  12.  
  13.  
  14. # Create function for border
  15. def border():
  16.     a = '=' * 60
  17.     print(a)
  18.  
  19.  
  20. # Input firstname, middle name, and lastname
  21. first_name = input("Input first name: ")
  22. middle_name = input("Input middle name: ")
  23. last_name = input("Input last name: ")
  24. full_name = first_name + " " + middle_name + " " + last_name
  25.  
  26. # Call function border() and name_reverse()
  27. border()
  28. print("The reverse of the first name: ", name_reverse(first_name))
  29. print("The reverse of the middle name: ", name_reverse(middle_name))
  30. print("The reverse of the last name: ", name_reverse(last_name))
  31. border()
  32. print("The reverse of the full name: ", name_reverse(full_name))
  33. border()
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement