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
A(n) file management system is a program that allows the creation of individual database tables, each of which is stored in its
Alja [10]
The answer is false. Database as defined bus026pressbooks.com is related to each other in such a way that it can be organized and managed. A database is an organized collection of related information. Therefore all are connected in a way that it can be managed, unrelated information is still related and is separated using folders. Such cases are school files that can have additional information or be transferred to another school.
7 0
3 years ago
Tech A says that gasoline vapors are lighter than air, so inspection pits do not have a fire hazard like above ground hoists. Te
Elden [556K]

Answer:

Tech B is correct.

Explanation:

First, It is international best practice never to exceed the lifting capacity of any hoist. To do so would expose those involved to risks that may prove to be fatal.

Second, research has shown that gasoline vapors, as well as vapor from almost all other flammable or ignitable liquids or substances, are heavier than air.

More specifically, Gasoline produces flammable vapors that are heavier than air by 3 to 4 times. This means they can travel for great distances along the ground. Worst still, inspection pits are must be kept free from gas vapors because they tend to accumulate in low or enclosed spaces.

Both technicians should and must observe all occupational, health, and safety rules and guidelines stipulated and required for their industry/practice.

Cheers

4 0
3 years ago
SOMEONE PLEASE HELP ME OUT WITH THIS!!!!!!
mario62 [17]

Answer:

C.

Explanation:

8 0
3 years ago
Read 2 more answers
Writing down your main ideas, subpoints, and supporting material, then using geometric shapes and arrows to indicate logical rel
horsena [70]

The process that involves writing down your main ideas, subpoints, and supporting material, then using geometric shapes is mapping.

This includes uses of  arrows to indicate logical relationships.

<h3>What is mapping?</h3>

mapping can be regarded as the prescribed way of assigning an object to each object in one set a particular object.

Learn more about mapping at:

brainly.com/question/25168859

7 0
3 years ago
What is the body of scientific knowledge based on?
ANTONII [103]
It depend on all such as guess ,observation ,hypothesis and etc
3 0
3 years ago
Read 2 more answers
Other questions:
  • In a five-choice multiple-choice test, which letter is most often the correct answer?
    7·2 answers
  • What would you use to compare two date ranges in a report?
    9·1 answer
  • I would A lot of knowledge and education for computers and <br> Technology
    10·2 answers
  • Which expresses 6y : 9y in its simplest form?
    12·1 answer
  • A virus is a self-replicating program that produces its own code by attaching copies of it into other executable codes.
    7·1 answer
  • Assume that the following method header is for a method in class A.
    15·1 answer
  • Write an algorithm that gets as input your current credit card balance, the total dollar amount of new purchases, and the total
    8·1 answer
  • What can you find the under the privacy policy section of a shopping website?
    12·1 answer
  • Write a string class. To avoid conflicts with other similarly named classes, we will call our version MyString. This object is d
    5·1 answer
  • Which componet is the smallest unit in a spreadsheet
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!