1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
AleksAgata [21]
4 years ago
3

Complete the body of the format_name function. This function receives the first_name and last_name parameters and then returns a

properly formatted string. Specifically: If both the last_name and the first_name parameters are supplied, the function should return like so:

Computers and Technology
1 answer:
Soloha48 [4]4 years ago
4 0

Answer:

Here is the Python program:

def format_name(first_name, last_name):  #function definition of format_name that takes first_name and last_name as parameters

   if first_name != '' and last_name != '':  #checks if first_name and last_name both are not equal to " "

       return ("Name: " + last_name + ", " + first_name)  #returns first name and last_name in format: "Name: last_name, first_name"

   elif first_name != '' or last_name != '':  #checks if either of the first_name or last_name is not equal to " "

       return ("Name: " + last_name + first_name)  #returns first name and last_name in format: "Name: last_name" or "Name: first_name"

   else:  #if both names are blank

       return ''  #return ""

 

Explanation:

The working of the above function can be checked by using the following statements:

print(format_name("Ernest", "Hemingway"))  

print(format_name("Voltaire", ""))  

print(format_name("", "Madonna"))  

print(format_name("", ""))

The program has a function format_name which takes two strings i.e. the first_name and last_name as parameters and returns the formatted string.

The first if condition checks if both the first_name and last_name are blank. For example if first_name = "Ernest" and last_name= "Hemingway" this means both the first_name and last_name are not blank or empty. So If this condition evaluates to true then the following statement is returned:

return ("Name: " + last_name + ", " + first_name)

This returns the last_name string first followed by a comma in between and then first_name string in the last. For the above example the string is printed in the following format:

Name: Hemingway, Ernest    

The elif condition checks if either of the first_name or last_name is blank. For example if first_name = "Voltaire" and last_name= "" this means last_name is blank or empty. So if this condition evaluates to true then the following statement is returned:

return ("Name: " + last_name + first_name)  

This returns the last_name string. For the above example the string is printed in the following format:

Name: Voltaire          

IF none of the above condition is true and both the first_name and last_name are blank then the following statement is returned

return ''  

This will just print and blank space in output.

The program and its output is attached.            

You might be interested in
Shawn thought that the screen of the block-based program he was using was
Alja [10]

Answer:

Interface

Explanation:

Definition- "The interface of a particular piece of computer software is its presentation on the screen and how easy it is to operate. <em>...the development of better user interfaces.</em>"

7 0
3 years ago
How do you find the exterior angle measure of any regular polygon? (The degree in which to turn the turtle to draw a shape)
Diano4ka-milaya [45]

Answer:

360/number of sides

Explanation:

all the exterior angles add up to 360°

so to find each angle mesure, divide the 360 by the number of sides the figure has.

7 0
4 years ago
In cell I5, enter a formula to calculate the total admission fees collected for the 2018
V125BC [204]
The formula is to calculate the total admission fees collected is = F5*B14

1. Click on cell I5
2. Type equal sign =
3. Type F5 or click on F5 cell
3. Type multiplication sign *
4. Type B14 or click on B14 cell
4 0
3 years ago
Read 2 more answers
How do you see the recent IT evolution (e.g. platforms, big data, Internet of Things, etc.) affect Internet security and privacy
torisob [31]

Answer:

Answered below

Explanation:

With the evolution and growth of technology, and as we are increasingly having our everyday lives dependent on technology, there arise problems that shouldn't be ignored.

Security of people's personal data and information is of paramount importance. Access to personal information and the sale of these information to companies without the owner's permission is a breach of privacy and one of the challenges we face today.

With the growth of data, there are newer threats and attacks on software security systems to steal these data and therefore there's a need for everyday assessment and improvement in security of data.

3 0
3 years ago
In video game development, the person who oversees and directs the entire design team and is the key vision keeper is
Sav [38]

Answer:

The Lead Designer

Explanation:

The Lead designers main role is to oversee how a game looks and is played. They manage a, normally small, design team. They work with them to come up with many aspects of the game itself like; characters, props, and plots to the game. they also, makes sure that the team itself stays on track, is within budget, and meets the designated deadlines.

3 0
3 years ago
Other questions:
  • PLS HURRY!! This OS introduced a very cool GUI that had animations and transparencies.
    5·1 answer
  • If you turn your volume to loud on u'r headphones can it break the sound quality of the speaker?
    9·2 answers
  • Which of the following cannot be performed from the windows task manager?
    15·2 answers
  • When numbers are changed in cells that are involved in formula is the formulas are automatically
    14·1 answer
  • When cleaning a firearm, what end of the firearm should you generally clean from?
    11·2 answers
  • What is top down design? a. Top down design is a way of designing your program by starting with the biggest problem and breaking
    7·1 answer
  • Kiara is using her software's graphic formats to create a line graph. As she
    9·2 answers
  • What was software for modems that connected through phone lines called?
    6·1 answer
  • Professional communication must be objective,
    8·1 answer
  • Instructions
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!