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
Veronika [31]
3 years ago
12

Create a Python program that: Allows the user to enter a person's first name and last name. The user should be able to enter as

many names as they desire. Create a function that takes the first name and last name, puts them together with the last name first, followed by the first name; with the names separated by commas. Take the result from the function, and place the resulting name in a list. Once the user finishes entering names, sort the contents of the list. Write the sorted names from a list into a text file. When you create the text file, allow the user to enter a name for the file to be created. After you finish writing names to the file, close the file and end the program.
Computers and Technology
1 answer:
KIM [24]3 years ago
7 0

Answer:

#main function start

def main():

#list to store names entered by user

name_list=[]

#variable to take input from user to keep rotating the loop and take input from user again and again

ch='y'

fname=""

lname=""

while ch=='y' or ch=='Y':#keep the loop taking input from user till user do not want to enter more

#take input from user

name=[]

fname=input("Enter first name: ")

lname=input("Enter last name: ")

name.append(fname)

name.append(lname)

 

#append the previously input first and last name in main list

name_list.append(name)

ch=input("Do you want to continue: (y/Y for yes)")

#main function end

#get file name from user

filename=input("Enter output file name")

#open file in write mode

file=open(filename,"w")

#keep loop add data in file till main list 'name_list' have

for i in name_list:

#Write data in file

file.write("%s, %s\r\n" % (i[0],i[1]))

#close the file

file.close()

#call main function

main()

Explanation:

input the above code and see output

You might be interested in
Which option can be used to automatically scan a document to prepare it for publishing, identifying personal information that sh
lubasha [3.4K]

Answer:

Document Inspector  option can be used to automatically scan a document to prepare it for publishing, identifying personal information that should be removed

Explanation:

Document scanner: This converts the text written in the paper in to a digital form. Most probably it will convert the text in paper in to image only.

Document Inspector is the tool which removes the personal information while sharing the document. The personal information can be name, mail id, phone number etc. This personal information though hidden will get reflected while publishing and this document inspector allow us to protect these data from sharing.

Privacy manager: This is a software reducing the risk of unauthorized access of data

Security manager: This once again protect the document.

4 0
4 years ago
Who is the orange and white Foxy that looks like Mangle but instead of pink its orange
Helga [31]

Answer:

Its Lolbit

Explanation:

Lolbit is an animatronic from Five Nights at Freddy's: Sister Location. It is a recolored version of Funtime Foxy's disembodied head, appearing as a minor Easter Egg from the main game.

7 0
3 years ago
To enter new code that performs as intended in the place of the old code that produces an error is the goal of
Tanzania [10]

Answer:

Fixing code in a software program.

Explanation:

It is regarded the easiest application development method, that is in many cases the standard (method)

Fixing code well into the software program because they came to realize that there was some error while they compose the program, then he will modify the program and then they will fix that again.

5 0
3 years ago
The FIFO method of computing equivalent units includes the beginning inventory costs in computing the cost per equivalent unit f
oksano4ka [1.4K]

Answer:

True

Explanation:

FIFO or first in first out is a system in business used to compute the equivalent costs per unit of inventory. The first product in the inventory, in FIFO, is the first product to be sold or opened for sales.

Although the cost of a unit separates the beginning inventory costs in computing the cost per equivalent unit from current production cost, it is for the current sales period of the first batch of inventory.

6 0
4 years ago
Can somebody help me with this please
lys-0071 [83]

Answer: I'm in six grade I can't do that stuff

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • Approximately what percent of U.S. businesses have some form of remote work program? (from Chapter 1)
    14·1 answer
  • A device that produces a permanent human-readable text of graphic document.
    15·1 answer
  • Have you been tempted to do something online that you wouldn't do if<br> people knew it was you?
    5·1 answer
  • List 5 major steps to make a bank deposit
    6·1 answer
  • Six causes of data lost
    14·1 answer
  • Which type of market are you in if your firm, along with three other firms, controls 95% of the total music industry?
    13·1 answer
  • Design pseudocode for a program that will permit a user to store exactly 50 numbers in an array. Create an array big enough to h
    10·1 answer
  • 7.3 A hydraulic lift has a mechanical advantage of 6. If the load weighs 780 N, calculate
    13·1 answer
  • Write a program that prompts the user to enter a date, using integer values for the month, day, and year, and then prints out th
    9·1 answer
  • Why is my computer fans making weird noises?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!