Write a Python program which accepts the user's first and last name and print them in reverse order 

Method 1:

firstname = input("Input your First Name : ")
lastname = input("Input your Last Name : ")
print ("Hello  " + firstname + " " + lastname)
output:-

Input your First Name : vikram
Input your Last Name : somai
Hello  vikram somai

method 2:-

def user_name():
  first_name = input('Please enter first name:')    
  last_name = input('Please enter last name:')    
  print(last_name,first_name)
user_name()
output:-
Please enter first name:hello
Please enter last name:world
world hello
>>> 

Tags:-

Print first and last name in reverse order with a space between them

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post