54.6k views
4 votes
Create a function called full_name. Pass two parameters to the function, an employee’s last name and first name. The function should return the full name in the format, last name, comma, space, first name (for example: Smith, Joe). Save your code.

User Wolli
by
5.3k points

1 Answer

6 votes

Answer:

The solution code is written in Python:

  1. def full_name(lastName, firstName):
  2. return lastName + ", " + firstName

Step-by-step explanation:

Firstly, create a function and name it as full_name that takes two parameters, lastName and firstName (Line 1).

In the function body, we can simply use plus operator, "+", to join the lastName string, comma and firstName string into a concatenated string. Please note a single space is made right after the comma (Line 2).

At last, return the concatenated string as function output.

User Leonardo Sapuy
by
4.5k points