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]
3 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]3 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
Typing which capitals and exclamation points in an email is an example of
Alexus [3.1K]
It's an example of a poorly written email, it looks like somebody is angry and yelling at you, these types of emails can be described as a poor etiquette.
4 0
3 years ago
Which is the most popular language used in game programming?
ANEK [815]

Answer:

B C++

Explanation:

The two most common languages for game designers to learn are C++ and Java, although other languages are popular (such as C# for Unity). Another type of programming you may hear referred to is scripting, but that essentially comes down to a type of systems programming.

4 0
3 years ago
Read 2 more answers
What is unique address in ICT​
iren2701 [21]

Answer:

IP Addressing.

Explanation:

It stands for Internet Protocol address. It is a unique address that identifies a computer on a network such as the Internet.

Hope this helped you!

4 0
3 years ago
Which of the following is NOT one of the MOST common uses of Twitter?
I am Lyosha [343]
Which of the following is NOT one of the MOST common uses of Twitter? b . Making a business contact.
5 0
3 years ago
Frrrrrrrrrrreeeeeeeeee brainliest for u
sukhopar [10]

Answer:

Yay I want brainliest

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • What is a good monitor for console gaming? (Any price)
    13·2 answers
  • The presentation ____ determines the formatting characteristics of fonts and colors.
    11·2 answers
  • Addition and subtraction are considered to be ____ operations performed by a computer.
    7·1 answer
  • ____ assigns a risk rating or score to each information asset. Although this number does not mean anything in absolute terms, it
    8·1 answer
  • What should you do before using a website to store student information ? A. Read and understand the website’s privacy contract
    11·2 answers
  • Someone knows a good compiler for iPad? It has to be an app
    10·1 answer
  • Write a program that reads a list of integers, and outputs the two smallest integers in the list, in ascending order. The input
    5·1 answer
  • You need to implement a class that represents the state of a room or game section. The class will contain a room_id, a descripti
    15·1 answer
  • An engine that generates hot, expanding gases by burning fuel inside the machine.
    9·1 answer
  • Answer pleaseeeeeeeeeee!
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!