Question: Complete the body of the format_name function. This function receives first_name and last name, then prints a formatted string of Name: last name, first name
Complete the body of the format_name function. This function receives first_name and last name, then prints a formatted string of "Name: last name, first name" if both names are not blank, or "Name:" with just one of the names, if the other one is blank, and nothing if both are blank. 1. def format_name(first_name, last_name) : 2 # code goes here return 5 print (format_name("Ernest", "Hemingway")) # Should be "Name: Hemingway, Ernest" 6 8 print (format_name", "Madonna")) # Should be "Name: Madonna" 10 11 print (format_name("Voltaire", "")) # Should be "Name: Voltaire" Run 14 15 print(format_name("","")) # Should be Reset
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
