Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Ralph Custodio
- # BSIT II-A
- # Create function for reversing a name string
- def name_reverse(name):
- rev_name = ''
- index = len(name)
- while index > 0:
- rev_name += name[index - 1]
- index = index - 1
- return rev_name
- # Create function for border
- def border():
- a = '=' * 60
- print(a)
- # Input firstname, middle name, and lastname
- first_name = input("Input first name: ")
- middle_name = input("Input middle name: ")
- last_name = input("Input last name: ")
- full_name = first_name + " " + middle_name + " " + last_name
- # Call function border() and name_reverse()
- border()
- print("The reverse of the first name: ", name_reverse(first_name))
- print("The reverse of the middle name: ", name_reverse(middle_name))
- print("The reverse of the last name: ", name_reverse(last_name))
- border()
- print("The reverse of the full name: ", name_reverse(full_name))
- border()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement