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
amid [387]
4 years ago
8

Many documents use a specific format for a person's name. Write a program whose input is: firstName middleName lastName, and who

se output is: lastName, firstName middleInitial. Ex: If the input is Pat Silly Doe, the output is: Doe, Pat S. If the input has the form firstName lastName, the output is lastName, firstName.
Computers and Technology
1 answer:
never [62]4 years ago
4 0

Answer:

Python Program:

if __name__ == '__main__':

   a = input("Enter Name: ")

   b = a.split()

   print(b[2] + ',' , b[0], b[1][0])

Explanation:

The input function will be used to prompt user to enter the name of the person. The person's name will be stored in variable a.

Let us assume that the user entered a name mentioned in the example, which is Pat Silly Doe, Now variable a = 'Pat Silly Doe'.

The function a.split() is used to split a string into a list. The splitting (by default) is done on the basis of white-space character. Therefore, a.split() will give a list

['Pat', 'Silly', 'Doe']

which will be later on stored in variable b.

We can use the subscript operator [] to access the values in a list. Suppose if we have a list a, then a[i] will give us ith element of a, if i < length of a.

Finally, we print the answer. b[2] will give us the last name of the person. We append a comma using '+' operator. b[0] will give us the first name. b[1] will give us the middle name, but since we only need one character from the middle name, we can use another subscript operator b[1][0] to give us the first character  of the middle name.

Note: Characters of strings can be accessed using subscript operator too.

You might be interested in
What is SoC? how is it different from CPU?
slamgirl [31]

Answer:

SoC usually contains a GPU

Explanation:

Where as a CPU cannot function without dozens of other chips

6 0
3 years ago
What disease can be transmitted through skin contact?
ollegr [7]

Answer:

the answer is chickenpox

4 0
4 years ago
Read 2 more answers
You are looking at a standard english ruler divided into eighths. If an item
Goryan [66]

Answer:

1)Measure with a ruler or tape measure. ...

2)Place the zero end of your rule at the end of your object. ...

3)Move to the opposite side of the object you are measuring. ...

4))Use a metric or decimal rule with a metric ruler. ...

5)Use a tape measure to measure between objects, for instance, walls.

Explanation:

A ruler marked in 16ths. Every mark is 1/16th of an inch. The center mark between numbers is 1/2. The red lines on these rulers are marked at 1/2, and 1. The next smallest marks on a ruler are 1/4ths.

7 0
3 years ago
Some websites create libraries specifically of writing that is in the public domain. What if the advantage of this?
dedylja [7]

Answer:

To provide further literature on particular issues of relevance

Explanation:

Libraries are specifically meant to provide readers with more information and knowledge. In other words, they enable you gain a sound knowledge on the issues you seek to know more about either in terms of product and services of the primary goal of the website, if necessary.

5 0
3 years ago
Examine the evolution of the World Wide Web (WWW) in terms of the need for a general-purpose markup language. Provide your persp
creativ13 [48]

WWW is used to browse for view the webpage basically content is normally displayed as HTML pages.

In any browser's webpage irrespective of language been used output content display as HTML pages only.

<u>Explanation:</u>

  • In other methods is used XML format where it is opened and closed tag for every word editing XML file is very useful.
  • XML tools are ready is available where end-user can edit or create by for example notepad++ extra
  • It is a language designed to store the data in a specific format and easily process and used by a coding language or web pages.
4 0
3 years ago
Other questions:
  • What is it called when a user makes a typing error when entering a url that takes him to an imposter website?
    5·1 answer
  • What systemctl command configures a unit to start the next time the computer boots?
    10·1 answer
  • If a person was on board a hypersonic airplane what do you think they would be able to see as they look out a window looking in
    13·2 answers
  • What is the latest date you can file the FAFSA if you're planning to start
    6·2 answers
  • Why might you complete a 1040 instead of a <br> 1040ez
    11·2 answers
  • A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number of steps, and whose output i
    14·1 answer
  • What are the process of boots up a computer?​
    10·1 answer
  • List an example of application software used in spreadsheet​
    11·2 answers
  • Another word for Arithmetic Logic Unit​
    6·1 answer
  • A program that performs handy tasks, such as computer management functions or diagnostics is often called a/an ____________.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!