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 input and output pair is correct for a bicycle?
mrs_skeptik [129]

Answer:

I'm pretty sure its B.

Explanation:

Input: Force is applied to the pedals by the rider's feet then..

Process: the chain and gear system convert the energy to cause...

Output: the rear wheels to turn and make the bike go foward

6 0
3 years ago
A ________ -tier design includes a middle layer between the client and server that processes the client requests and translates
Vanyuwa [196]

Answer:

Three.

Explanation:

5 0
3 years ago
import java.util.ArrayList; // Needed for ArrayList class /** This program demonstrates how to store BankAccount objects in an A
slega [8]

Answer:

import java.util.ArrayList; // Needed for ArrayList class

/** This program demonstrates how to store BankAccount objects in an ArrayList. */

// Class ArrayListDemo6 is defined

public class ArrayListDemo6 {

// main method that begin program execution

public static void main(String[] args) {

// Create an ArrayList to hold BankAccount objects.

// The arraylist is called list

ArrayList list = new ArrayList();

// Add three BankAccount objects to the ArrayList.

list.add(new bankAccount(100.0)); list.add(new bankAccount(500.0)); list.add(new bankAccount(1500.0)); // Display each item using a for loop

for (int index = 0; index < array.size(); index++)

{ BankAccount account = list.get(index);

System.out.println("Account at index " + index + "\nBalance: " + account.getBalance());

}

}

}

Explanation:

The code is written in Java and more comments has been added to make it more explanatory.

The code snippet is a demonstration on Arraylist.

First Arraylist is imported. Then, ArrayListDemo6 class is defined. Then the main method which begin program execution.

Inside the main method, a new Arraylist is created called list.

Then we add three BankAccount object to the list.

Lastly, we use a for loop to display each added BankAccount object.

7 0
3 years ago
The smaller RAM a computer has, the more software you can have open without impacting the speed of your computer
dsp73
False, forsure mates but gotta love the question:)
4 0
3 years ago
Mrs. Johnson is here today to receive an intercostal nerve block to mitigate the debilitating pain of her malignancy. Her cancer
Furkat [3]

Answer:

The correct answer is:

a. M54.6, C79.51, C80.1

Explanation:

-  M54.6 Pain in thoracic spine. It is a billable/specific ICD-10-CM code that can be used to indicate a diagnosis for reimbursement purposes. The 2020 edition of ICD-10-CM M54.

- C79.51: Secondary malignant neoplasm of bone, it is a billable/specific ICD-10-CM code that can be used to indicate a diagnosis for reimbursement purposes.

- G89. 3 is a billable/specific ICD-10-CM code that can be used to indicate a diagnosis for reimbursement purposes. The 2020 edition of ICD-10-CM G89.

Malignant neoplasm of anus, unspecified

Neoplasm related pain (acute) (chronic)

Pain in thoracic spine. M54. 6 is a billable/specific ICD-10-CM code that can be used to indicate a diagnosis for reimbursement purposes. The 2020 edition of ICD-10-CM M54.

Malignant (primary) neoplasm, unspecified

- C80. 1 is a billable/specific ICD-10-CM code that can be used to indicate a diagnosis for reimbursement purposes. The 2020 edition of ICD-10-CM C80.

5 0
3 years ago
Other questions:
  • Which of the following are common problems experienced with software applications?
    15·1 answer
  • what would happen if a large number of computer users are attempting to access a web site at the same time that you are
    15·2 answers
  • Read the following scenario: A project will require more people than originally estimated. Identify the possible risks to the pr
    8·2 answers
  • A ________ is a user-interface component with two states: checked and unchecked. radio button check box menu item submenu item
    5·1 answer
  • Write the Python code to implement each step of the following algorithm. Your code should use descriptive variable names and per
    7·1 answer
  • A user prefers an external monitor, mouse, and keyboard for a laptop. The user does not want to use the built-in screen; however
    5·1 answer
  • Charles would like to move his internet browser window so that he can see his desktop.He should
    5·1 answer
  • Type 1 hypervisor:
    10·1 answer
  • etwork behavior analysis system __________ sensors are typically intended for network perimeter use, so they are deployed in clo
    10·1 answer
  • Write and test a Python program to find and print the largest number in a set of real (floating point) numbers. The program shou
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!