6.6 LAB Name Format

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

6.

6 LAB Name format


Many documents use a specific format for a person's name. Write a program whose input
is:
firstName middleName lastName
and whose output is:
lastName, firstInitial.middleInitial.
Ex: If the input is:
Pat Silly Doe
the output is:
Doe, P.S.
If the input has the form:
firstName lastName
the output is:
lastName, firstInitial.
Ex: If the input is:
Julia Clark
the output is:
Clark, J.

complete_name=input().split()

length=len(complete_name)

if length==3:

print(complete_name[2]+", "+complete_name[0][0]+"."+complete_name[1][0]+".")

if length==2:

print(complete_name[1]+", "+complete_name[0][0]+".")

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy