Using Python code.
Fill in the gaps in the nametag function so that it uses the format method to return first_name and the first initial of last_name followed by a period. For example, nametag("Jane", "Smith") should return "Jane S."
def nametag(first_name, last_name):
return("___.".format(___))
print(nametag("Jane", "Smith"))
# Should display "Jane S."
print(nametag("Francesco", "Rinaldi"))
# Should display "Francesco R."
print(nametag("Jean-Luc", "Grand-Pierre"))
# Should display "Jean-Luc G."

Respuesta :

Answer:

def nametag(first_name, last_name):

return("{} {[0]}.".format(first_name, last_name))

print(nametag("Jane", "Smith"))

# Should display "Jane S."

print(nametag("Francesco", "Rinaldi"))

# Should display "Francesco R."

print(nametag("Jean-Luc", "Grand-Pierre"))

# Should display "Jean-Luc G."

Explanation:

First you must think about that the question ask about the first letter for last_name, remember [0] is the first letter not [1], the other part is about format function and its order

The format method to return first_name and the first initial of last_name followed by a period in python is represented as follows:

def nametag(first_name, last_name):

  return '{} {}.'.format(first_name, last_name[0])

print(nametag("Jane", "Smith"))

print(nametag("Francesco", "Rinaldi"))

print(nametag("Jean-Luc", "Grand-Pierre"))

A function named nametag is declared with the arguments first_name and last_name.

Then it returns the first name and the initial of the last_name using the .format method.

Then we call the function using the print statement with the arguments.

learn more on python code; https://brainly.com/question/17184408?referrer=searchResults

Ver imagen vintechnology