Formatting Names with Title Case

  • Share this:

Code introduction


This function takes two arguments, first name and last name, and uses the str.title() method to capitalize the first letter of each name. Then it concatenates the first name and last name to return the full name.


Technology Stack : String manipulation

Code Type : String formatting

Code Difficulty :


                
                    
def format_name(first, last):
    """
    Format a full name from first and last names.
    """
    full_name = f"{first.title()} {last.title()}"
    return full_name