1:24 Back Hwrk07.pdf Q Homework 07 COMSC-122 Homework-07A You will find two files in your Homework07...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1:24 Back Hwrk07.pdf Q Homework 07 COMSC-122 Homework-07A You will find two files in your Homework07 dropbox: GirlNames.txt - which is a file containing a list of the 200 most popular names given to girls born in the United State from the year 2000 through 2009. BoyNames.txt-which is a file containing a list of the 200 most popular names given to boys born in the United State from the year 2000 through 2009. *Write a program that reads the contents of the two files into two separate lists. Then the user will be asked: "If you are looking up a Girl's name, enter "G' or 'g, if a Boy's name, enter "B or : Next the user will be asked to enter the name that (she wants to look up. Dashboard The application will then display a message indicating whether the name entered was one of the most popular or not. *Then your program should ask if you want to look up another name. 5G Homework-07A Call your program: Your Name-Hwrk7A.py Tip: You might find programs 7-15 and 7-2 helpful in solving this problem. Calendar To Do Notifications M Inbox 1:24 < Back Homework-07B Design a program that reads a textfile, rainfall.txt, containing the total rainfall in the Bay Area for each of 12 months, into a list. The program should calculate and display the following: The Total rainfall for the year; The average monthly rainfall for the year; The month in which the maximum rainfall occurs; The month in which the minimum rainfall occurs. Call your program: YourName-Hwrk78.py It's not essential, but you may want to make use of a file called: months.txt, which contains a list of the names of the months of the year in order. That file can be input to form another list called months[] Homework07B Tip: The easiest way to do the last two parts of the program is to: 1. Find the maximum(or minimum) rainfall for the year in the list you make of the rainfall data; 2. Determine the index of that maximum(or minimum) element: More Hints: 21 H 3. Look up the month of the year, in a list of months, for which the index is the same as the index that you found in step 2. You may find Programs 7-17 and 7-4 helpful. . You may want to use the min and max methods. Program 7-17 (read number 11st py) #progrers from a seg pe for rating Hwrk07.pdf Q the Cit thes of the artial Dashboard Program Output Calendar 5G [ To Do Program 7-17: Reading a List of Numbers from a File Notifications M Inbox 1:24 < Back 1.2.3.4.5 Program 7-4 (index_list.py) # 9 10 # 12 13 15: 16 17 Dashboard 21 23 217 Program 7-4: Using Indexes - Part 1 of 2 This program demonstrates how to get the index of an item in a list and then replace that item with a new item. det main() 31 33 if 33 Hwrk07.pdf Q Create a list with some items. food (Pizza, "Burgers", "Chips" Display the list. print("Here are the itens in the food lists") print (food) Cet the item to change. item input("Which iten should I change? Program 7-4: Using Indexes - Part 2 of 2 Get the item's index in the list. ite_index-food.index(iten) Get the value to replace it with. new_item inputs 'Ester the new value: 1 Replace the old item with the new item. food[item_indes) sow_im Display the list. print("Here is the revised it's print (food) except ValueErroes Call the main function. main() print! That item was not found in the list.") Calendar Program 7-4 . Results Program Output (with input shown in bold) Here are the items in the food list: (Pissa", 'Burgers, Chips" Which item should I change? Burgers (re Enter the new value: Pickles Here is the revised lists 1 Pizza, Pickles', 'Chips'] 8 Like To Do D 5G Notifications M Inbox 1:24 Back Hwrk07.pdf Q Homework 07 COMSC-122 Homework-07A You will find two files in your Homework07 dropbox: GirlNames.txt - which is a file containing a list of the 200 most popular names given to girls born in the United State from the year 2000 through 2009. BoyNames.txt-which is a file containing a list of the 200 most popular names given to boys born in the United State from the year 2000 through 2009. *Write a program that reads the contents of the two files into two separate lists. Then the user will be asked: "If you are looking up a Girl's name, enter "G' or 'g, if a Boy's name, enter "B or : Next the user will be asked to enter the name that (she wants to look up. Dashboard The application will then display a message indicating whether the name entered was one of the most popular or not. *Then your program should ask if you want to look up another name. 5G Homework-07A Call your program: Your Name-Hwrk7A.py Tip: You might find programs 7-15 and 7-2 helpful in solving this problem. Calendar To Do Notifications M Inbox 1:24 < Back Homework-07B Design a program that reads a textfile, rainfall.txt, containing the total rainfall in the Bay Area for each of 12 months, into a list. The program should calculate and display the following: The Total rainfall for the year; The average monthly rainfall for the year; The month in which the maximum rainfall occurs; The month in which the minimum rainfall occurs. Call your program: YourName-Hwrk78.py It's not essential, but you may want to make use of a file called: months.txt, which contains a list of the names of the months of the year in order. That file can be input to form another list called months[] Homework07B Tip: The easiest way to do the last two parts of the program is to: 1. Find the maximum(or minimum) rainfall for the year in the list you make of the rainfall data; 2. Determine the index of that maximum(or minimum) element: More Hints: 21 H 3. Look up the month of the year, in a list of months, for which the index is the same as the index that you found in step 2. You may find Programs 7-17 and 7-4 helpful. . You may want to use the min and max methods. Program 7-17 (read number 11st py) #progrers from a seg pe for rating Hwrk07.pdf Q the Cit thes of the artial Dashboard Program Output Calendar 5G [ To Do Program 7-17: Reading a List of Numbers from a File Notifications M Inbox 1:24 < Back 1.2.3.4.5 Program 7-4 (index_list.py) # 9 10 # 12 13 15: 16 17 Dashboard 21 23 217 Program 7-4: Using Indexes - Part 1 of 2 This program demonstrates how to get the index of an item in a list and then replace that item with a new item. det main() 31 33 if 33 Hwrk07.pdf Q Create a list with some items. food (Pizza, "Burgers", "Chips" Display the list. print("Here are the itens in the food lists") print (food) Cet the item to change. item input("Which iten should I change? Program 7-4: Using Indexes - Part 2 of 2 Get the item's index in the list. ite_index-food.index(iten) Get the value to replace it with. new_item inputs 'Ester the new value: 1 Replace the old item with the new item. food[item_indes) sow_im Display the list. print("Here is the revised it's print (food) except ValueErroes Call the main function. main() print! That item was not found in the list.") Calendar Program 7-4 . Results Program Output (with input shown in bold) Here are the items in the food list: (Pissa", 'Burgers, Chips" Which item should I change? Burgers (re Enter the new value: Pickles Here is the revised lists 1 Pizza, Pickles', 'Chips'] 8 Like To Do D 5G Notifications M Inbox
Expert Answer:
Answer rating: 100% (QA)
For the first part creating a program named YourNameHwrk7Apy to read the lists of popular names from files and check if a given name is among the most ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Calculate the required transformer turns ratio and inverter side voltage 2 so that rated dc power and voltage are maintained with a firing angle = 15. Please note that although the transformer's...
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
Googles ease of use and superior search results have propelled the search engine to its num- ber one status, ousting the early dominance of competitors such as WebCrawler and Infos- eek. Even later...
-
Katz Hat Shop received a shipment of hats for which it paid the wholesaler $2,970. The price of the hats was $3,000, but Katz was given a $30 cash discount and required to pay freight charges of $50....
-
An isolated capacitor of unknown capacitance has been charged to a potential difference of 100 V. When the charged capacitor is then connected in parallel to an uncharged 10.0-F capacitor, the...
-
A coal-fired electrical generating station can use a higher TH than a nuclear plant; for safety reasons the core of a nuclear reactor is not allowed to get as hot as coal. Suppose that TH = 727C for...
-
The following stream at \(100^{\circ} \mathrm{F}\) and 250 psia is to be separated into the four indicated products. Also, given is the cost of each of the unique separators. Determine: (a) The best...
-
Bloomington has two hospitals. Hospital 1 has four ambulances, and hospital 2 has two ambulances. Ambulance service is deemed adequate if there is only a 10% chance that no ambulance will be...
-
In Thunder Bay, a public survey was done that suggests that people are generally supportive of using automated, AI-based video analysis software [1]. Yet, elsewhere in Canada, such software has come...
-
Iranzo Ammunition is an all-equity firm that currently has 6,000,000 shares outstanding worth $50 per share. The company's considering converting to a capital structure that is 50.0% debt. The firm...
-
A Weedicides is a chemical that is used to destroy weeds. (true or false)
-
(20 points) Consider a 2 period bargaining problem. There are two players 1 and 2 - who have to share a prize worth $1. However, unlike what we have seen in class, the player now have different...
-
To what extent should people be able to move from the private sector to government and back (think of people moving from an industry like the oil or pharma industries to government regulatory bodies...
-
Janice owns a business that builds and sells custom skateboards. Last year she sold 480 skateboards for $200 each. To make the boards she purchased wood, wheels, paint, and other components that cost...
-
Indicate whether the business activity noted below is an event or a transaction. Hired an advertising firm to develop a TV ad for a new product. The ad will be finished next month and you will pay...
-
Prepare for the inevitablethe day you do not know an answer. Sometimes, it feels embarrassing to ask questions at work. In the following situations, which questions are im-portant to ask at work, and...
-
1. Explain your understanding of energy: a.) What is energy (giving examples)? What are the different units of energy? b.) What is power? How does it differ from energy? c.) What is the difference...
-
Given the table below, about how much force does the rocket engine exert on the 4.0 kg payload? Distance traveled with rocket engine firing (m) Payload final velocity (m/s) 500 320 490 310 1020 450...
-
Patty Bayan is a single taxpayer living at 543 Space Drive, Houston, TX 77099. Her Social Security number is 466-33-1234. For 2012, Patty has no dependents, and her W-2 from her job at a local...
-
David and Darlene Jasper have one child, Sam, who is 6 years old. The Jaspers reside at 4639 Honeysuckle Lane, Los Angeles, CA 90248. David's Social Security number is 577-11-3311, Darlene's is...
-
Cedar Corporation has an S corporation election in effect. During the 2012 calendar tax year, the corporation had ordinary taxable income of $200,000, and on January 15, 2012, the corporation paid...
-
Is leadership synonymous with management, or is leading just one of the many things that a manager does? In what ways are they the same or different?
-
Explain Blake and Moutons Leadership Grid in relationship to previous leadership research.
-
Write a description of an effective manager. Write words that you would use to describe an effective leader. When you review your list, consider the differences and similarities in your adjectives....
Study smarter with the SolutionInn App