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
PLEASE PLEASE PLEASE PLEASE PLEASE HELP! I'M BEGGING Y'ALL! I NEED THIS FOR TODAY! CORRECT ANSWERS WILL BE AWARDED BRAINLIEST!
Fiesta28 [93]

Answer:

You can make an online memorial, you can write their story online, you could make videos for them, technologhy allows many people to thank them, band you can donate things online to them.

Explanation:

Im not sure if this is right but its what first came up into my head

4 0
3 years ago
Problem of Nigeria under primary education
Artist 52 [7]
Primary school education in Nigeria is bisected with myriads of problems including: poor funding, poor educational infrastructures, overcrowding, inadequate classrooms and poor/polluted learning environment
8 0
4 years ago
Although saying "Cylinder IS A Circle" doesn't make sense, it can be implemented in Java using inheritance in a legitimate way.
allochka39001 [22]

Answer:

I've included in the codes the area to circle and volume to cylinder. The Volume method that was used, area() to compute, the volume of cylinder which shows that cylinder is an expansion of circle with an extra dimension (height)

Explanation:

Temp is tester class

public class Temp {

   public static void main(String[] args) {

       Circle c = new Circle(7);

       System.out.println("Area of circle with radius 7 is "+c.area());

       Cylinder c1 = new Cylinder(7,10);

       System.out.println("Cylinder volume with radius 7 and height 10: "+c1.volume());

   }

}

----------------------------------------------------------------------------------------------------

class Circle{

   int radius;

   Circle(int r){

       radius=r;

   }

   double area(){  //area of circle

       return 3.14*radius*radius;

   }

   public int getRadius() {

       return radius;

   }

   public void setRadius(int radius) {

       this.radius = radius;

   }

}

class Cylinder extends Circle{

   int height;

   Cylinder(int r, int h){

       super(r);

       height=h;

   }

   double volume(){  //volume of cylinder

       return area()*height;

   }

   public int getHeight() {  //accessor

       return height;

   }

   public void setHeight(int height) {  //mutator

       this.height = height;

   }

}

8 0
4 years ago
In Java please:
topjm [15]

Answer:

import java.util.Scanner;

public class Supermarket

{

public static void main (String[] args)

{  

String item;

double pounds, ounces, price,

total, unit;

Scanner scn = new Scanner(System.in);

System.out.print("Please enter the name of item ");

item = scn.nextLine();

System.out.print("Please enter the price of "  + "the item per pound : ");

price = scn.nextDouble();

System.out.print("Enter the weight of "  + "the item in pounds and "  + "ounces respectively : ");

pounds = scn.nextDouble();

ounces = scn.nextDouble();

unit = price/16;

total = price * (pounds + ounces/16);

System.out.print("The unit price of "  + "the products sold is : "  + unit);

System.out.print("\nThe total cost of the "  + "amount purchased is : "  + total);

}

}

Explanation:

  • Ask the user to enter the price of  the item and the weight.
  • Calculate the unit and the total price.
  • Display the unit and the total price.

6 0
3 years ago
Read 2 more answers
Which qualifications are typical for someone working in Marketing Information Management and Research?
Harman [31]

Answer:

• good teamwork skills and knowledge of search engines and social media.

• math skills for calculating prices, good teamwork, and physical stamina.

• a pleasant attitude, critical-thinking skills for designing surveys, and social awareness.

• creativity, persuasiveness, and good social skills when dealing with news media contacts.

Explanation:

Marketing Information Management and Research is a system in an organization whereby skills such as Marketing Information and Research are made use of by marketers to ensure that they come to know who their consumers are , what exactly the consumers want and how they can satisfy the needs and wants of the consumers using a very fast , precise and correct methods.

A person who works in Marketing Information Management and Research must have the following skills:

• good teamwork skills and knowledge of search engines and social media : Accurate knowledge of search engines such as google e.t.c. helps a person working in Marketing Information Management and Research to have access to the latest trends that consumers follow. These trends provides adequate information about the needs of consumers that is required in research.

Good teamwork skills is very important as it makes working in Marketing Information Management and Research very orderly, there is absence of chaos, when working with one another, creative ideas are obtained.

• math skills for calculating prices, good teamwork, and physical stamina : These skills above are very essential because such a person need to have adequate knowledge of the prices of goods and services that they produce. Physical stamina is also and essential skill.

• a pleasant attitude, critical-thinking skills for designing surveys, and social awareness : These qualifications are important because critical thinking helps a such a person to be able to come up with or create a solution using information from the surveys to accurately meet the needs of the consumers.

Having skills in social awareness gives the person working in Marketing Information Management and Research up to date information about what a consumer wants at this particular time or moment.

• creativity, persuasiveness, and good social skills when dealing with news media contacts: These skills are essential because consumers need to see creativity in products and services that they want as it makes them more attractive.

Having good social skills when dealing with news media contacts is also very important.

6 0
3 years ago
Other questions:
  • Write a program to provide information on the height of a ball thrown straight up into the air. The program should request as in
    5·2 answers
  • Not all products are well suited for sale on the internet. T or F
    11·2 answers
  • Suppose that a program performs an intermixed sequence of (stack) push and pop operations. The push operations put the integers
    9·1 answer
  • To convince the server that a user is authentic, the authentication server creates a _________ that contains the user's ID and n
    13·1 answer
  • How are logical operators used?
    14·1 answer
  • The rate of flow is called
    11·1 answer
  • The intelligence displayed by humans and other animals is termed?
    15·1 answer
  • A(an)_______is built-in preset calculation. <br>formula <br> function <br>equation <br>AutoSum​
    12·1 answer
  • PLSS HELP ASAP ILL GIVE BRAINLIEST THANKS
    15·2 answers
  • Is hp pavilion pc a digital or analog computer
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!