Write a function calledformat_name that accepts a string in the format offirst name followed by last name as a parameter, and thenreturns a string in reverse order(i.e., last name, first name). You may assume that only a first andlast name will be given.
For example, format_name(\"Jared Smith\") should return \"Smith,Jared\"
Hint: The following String Methods will be useful:
# Returns the lowest index in the string where substring is# found. Returns -1 if substring is not foundmy_string = “eggplant”index = my_string.find(“plant”) # returns 3# Returns all the characters after the specific indexmy_string = \"hello world!\"print my_string[1:] # returns \"ello world!\"print my_string[6:] # returns \"world!\"# Returns all the characters before the specific indexmy_string = \"hello world!\"print my_string[:6] # returns \"hello\"print my_string[:1] # returns \"h\"
Your program should include:
- A main method that uses user input to prompt and read a stringthat contains a person's first name and last name
- A call to format_name and a print statement that prints theoutput returned by format_name
- A call to the main function
PLEASE HELP PYTHON COMPUTER SCIENCE