Your program is to have a main() function which controls the program by calling the appropriate...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Your program is to have a main() function which controls the program by calling the appropriate functions. Create two lists from 1 to 10 values. Each value should be a random number generated value from 1 to 10. Create a function to generate these lists. This function will have to be called twice from main(). Once for each list. The number of elements per list is to be input by the user and be from 1 to 10, so pass that value into the generate list function as a parameter. Do not allow 0 or negative input for the number of elements. Write two more functions, one to add the two lists of corresponding indexed values together and one to multiple the two lists of corresponding indexed values and store the results in a new list and return the new list. For adding, you take list1[0] and add it to list2[0], add list1[1] and list2[2] and so on for the number of elements in the list. For multiplying, take list 1[0] and multiply it times list2[0] and so on for each element in the list and store this value in a new list and return that list. Create a displayList() function to display the four lists. Pass in a reference to the list which needs to be printed. Do this for all four lists. Format your output in aligned columns using the format specifier command. How many numbers per list: 5. 8 10 4 List 1:7 1 List 2: 2 7 10 8 Added List: 3 15 20 14 Multiplied List: 2 56 100 48 20 >>> | 9 5 The first column is the prompt column. Do not hardcode these in the print statement, but pass them into the displayList() function as a parameter. Function Description main() - controls the program and contains the logic. Calls all the other functions. getNumber() - has no parameters and gets input from the user on the number of elements in each list. Return that value to main. CSC1019 Intro to Programming (Python) Kenneth W. Riddle generateList() - receives as a parameter the number of elements per list and generates that many random values between 1 and 10 adding them to a list and returns that list to main. This function will be called twice in your program. addLists() - receives as a parameter the two lists and add corresponding index elements together and stores the added values in a new list. It returns that list to main. multiplyLists() - receives as a parameter the two lists and multiplies corresponding index elements together and stores the resulting values in a new list. It returns that list to main. displayList() - receives as a parameter a prompt and a list. The prompt is first printed and then the list of values. In the sample run, List 1: is a prompt as are all the items below it. The list of values need to be aligned. Do not print if list1 or list2 are empty. This function will be called four times by your program, once for each line being printed. Here is a VTOC of the program: getNumber() generateList() Main() addLists() multiplyLists() displayList() Your program is to have a main() function which controls the program by calling the appropriate functions. Create two lists from 1 to 10 values. Each value should be a random number generated value from 1 to 10. Create a function to generate these lists. This function will have to be called twice from main(). Once for each list. The number of elements per list is to be input by the user and be from 1 to 10, so pass that value into the generate list function as a parameter. Do not allow 0 or negative input for the number of elements. Write two more functions, one to add the two lists of corresponding indexed values together and one to multiple the two lists of corresponding indexed values and store the results in a new list and return the new list. For adding, you take list1[0] and add it to list2[0], add list1[1] and list2[2] and so on for the number of elements in the list. For multiplying, take list 1[0] and multiply it times list2[0] and so on for each element in the list and store this value in a new list and return that list. Create a displayList() function to display the four lists. Pass in a reference to the list which needs to be printed. Do this for all four lists. Format your output in aligned columns using the format specifier command. How many numbers per list: 5. 8 10 4 List 1:7 1 List 2: 2 7 10 8 Added List: 3 15 20 14 Multiplied List: 2 56 100 48 20 >>> | 9 5 The first column is the prompt column. Do not hardcode these in the print statement, but pass them into the displayList() function as a parameter. Function Description main() - controls the program and contains the logic. Calls all the other functions. getNumber() - has no parameters and gets input from the user on the number of elements in each list. Return that value to main. CSC1019 Intro to Programming (Python) Kenneth W. Riddle generateList() - receives as a parameter the number of elements per list and generates that many random values between 1 and 10 adding them to a list and returns that list to main. This function will be called twice in your program. addLists() - receives as a parameter the two lists and add corresponding index elements together and stores the added values in a new list. It returns that list to main. multiplyLists() - receives as a parameter the two lists and multiplies corresponding index elements together and stores the resulting values in a new list. It returns that list to main. displayList() - receives as a parameter a prompt and a list. The prompt is first printed and then the list of values. In the sample run, List 1: is a prompt as are all the items below it. The list of values need to be aligned. Do not print if list1 or list2 are empty. This function will be called four times by your program, once for each line being printed. Here is a VTOC of the program: getNumber() generateList() Main() addLists() multiplyLists() displayList() Your program is to have a main() function which controls the program by calling the appropriate functions. Create two lists from 1 to 10 values. Each value should be a random number generated value from 1 to 10. Create a function to generate these lists. This function will have to be called twice from main(). Once for each list. The number of elements per list is to be input by the user and be from 1 to 10, so pass that value into the generate list function as a parameter. Do not allow 0 or negative input for the number of elements. Write two more functions, one to add the two lists of corresponding indexed values together and one to multiple the two lists of corresponding indexed values and store the results in a new list and return the new list. For adding, you take list1[0] and add it to list2[0], add list1[1] and list2[2] and so on for the number of elements in the list. For multiplying, take list 1[0] and multiply it times list2[0] and so on for each element in the list and store this value in a new list and return that list. Create a displayList() function to display the four lists. Pass in a reference to the list which needs to be printed. Do this for all four lists. Format your output in aligned columns using the format specifier command. How many numbers per list: 5. 8 10 4 List 1:7 1 List 2: 2 7 10 8 Added List: 3 15 20 14 Multiplied List: 2 56 100 48 20 >>> | 9 5 The first column is the prompt column. Do not hardcode these in the print statement, but pass them into the displayList() function as a parameter. Function Description main() - controls the program and contains the logic. Calls all the other functions. getNumber() - has no parameters and gets input from the user on the number of elements in each list. Return that value to main. CSC1019 Intro to Programming (Python) Kenneth W. Riddle generateList() - receives as a parameter the number of elements per list and generates that many random values between 1 and 10 adding them to a list and returns that list to main. This function will be called twice in your program. addLists() - receives as a parameter the two lists and add corresponding index elements together and stores the added values in a new list. It returns that list to main. multiplyLists() - receives as a parameter the two lists and multiplies corresponding index elements together and stores the resulting values in a new list. It returns that list to main. displayList() - receives as a parameter a prompt and a list. The prompt is first printed and then the list of values. In the sample run, List 1: is a prompt as are all the items below it. The list of values need to be aligned. Do not print if list1 or list2 are empty. This function will be called four times by your program, once for each line being printed. Here is a VTOC of the program: getNumber() generateList() Main() addLists() multiplyLists() displayList() Your program is to have a main() function which controls the program by calling the appropriate functions. Create two lists from 1 to 10 values. Each value should be a random number generated value from 1 to 10. Create a function to generate these lists. This function will have to be called twice from main(). Once for each list. The number of elements per list is to be input by the user and be from 1 to 10, so pass that value into the generate list function as a parameter. Do not allow 0 or negative input for the number of elements. Write two more functions, one to add the two lists of corresponding indexed values together and one to multiple the two lists of corresponding indexed values and store the results in a new list and return the new list. For adding, you take list1[0] and add it to list2[0], add list1[1] and list2[2] and so on for the number of elements in the list. For multiplying, take list 1[0] and multiply it times list2[0] and so on for each element in the list and store this value in a new list and return that list. Create a displayList() function to display the four lists. Pass in a reference to the list which needs to be printed. Do this for all four lists. Format your output in aligned columns using the format specifier command. How many numbers per list: 5. 8 10 4 List 1:7 1 List 2: 2 7 10 8 Added List: 3 15 20 14 Multiplied List: 2 56 100 48 20 >>> | 9 5 The first column is the prompt column. Do not hardcode these in the print statement, but pass them into the displayList() function as a parameter. Function Description main() - controls the program and contains the logic. Calls all the other functions. getNumber() - has no parameters and gets input from the user on the number of elements in each list. Return that value to main. CSC1019 Intro to Programming (Python) Kenneth W. Riddle generateList() - receives as a parameter the number of elements per list and generates that many random values between 1 and 10 adding them to a list and returns that list to main. This function will be called twice in your program. addLists() - receives as a parameter the two lists and add corresponding index elements together and stores the added values in a new list. It returns that list to main. multiplyLists() - receives as a parameter the two lists and multiplies corresponding index elements together and stores the resulting values in a new list. It returns that list to main. displayList() - receives as a parameter a prompt and a list. The prompt is first printed and then the list of values. In the sample run, List 1: is a prompt as are all the items below it. The list of values need to be aligned. Do not print if list1 or list2 are empty. This function will be called four times by your program, once for each line being printed. Here is a VTOC of the program: getNumber() generateList() Main() addLists() multiplyLists() displayList()
Expert Answer:
Answer rating: 100% (QA)
Python version 38 import random def getNumber Function that ... View the full answer
Related Book For
Auditing a risk based approach to conducting a quality audit
ISBN: 978-1133939153
9th edition
Authors: Karla Johnstone, Audrey Gramling, Larry Rittenberg
Posted Date:
Students also viewed these programming questions
-
Autumn Company began the month of October with inventory of $29,000. The following inventory transactions occurred during the month: a. The company purchased inventory on account for $43,000 on...
-
Gilbert Canned Produce (GCP) packs and sells three varieties of canned produce: green beans; sweet peas; and tomatoes. The company is currently operating at 82 percent of capacity. Worried about the...
-
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...
-
MW Canada developed a 90-hour technical training program that was delivered over two months. Because it enabled the loom mechanics to act more independently with less downtime if the total cost was...
-
An article in the Wall Street Journal noted that as a result of lower gasoline prices, sales "improved notably over the last two months at Back Yard Burgers, a dining chain based in Nashville, Tenn."...
-
The rate of solar energy striking Earth averages 168 watts per square meter. The rate of energy radiated from Earth's surface averages 390 watts per square meter. Comparing these numbers, one might...
-
Which account does a merchandiser use that a service company does not use? a. Cost of goods sold b. Inventory C. Sales revenue d. All of the above
-
Hayes (2000) took a stratified sample of New York City food stores. The sampling frame consisted of 1408 food stores with at least 4000 square feet of retail space. The population of stores was...
-
CoursHeroTranscribedText You have been recruited by a former classmate, Susanna Wu, to join the finance team of a company that she founded recently. The company produces a unique product line of...
-
Express Delivery is a rapidly growing delivery service. Last year, 80% of its revenue came from the delivery of mailing "pouches" and small, standardized delivery boxes (which provides a 20%...
-
The Acorn Nursery School Corporation provides baby-sitting and childcare programs. On January 31, 20xx, the company had the following trial balance: During the month of February, the company...
-
A researcher estimated a model for the daily percentage returns (rt) on the Australian stock market index over the last 100 days of trading. The results for this model (Model 1) were: rt = 0.25...
-
The management of Sonate Company, a wholesale distributor of fashion products, is considering the purchase of a $72,000 machine that would reduce operating costs in its warehouse by $16,000 per year....
-
A scuba diver and her gear displace a volume of 62.0 L and have a total mass of 65.8 kg. Part A What is the buoyant force on the diver in sea water? FB = Submit Request Answer Part B Will the diver...
-
Demand is strong and Nick Seamon can sell more sandwiches. In the short-run, how can his daily deli handle more volume? What will happen to the marginal product of labor at higher production? Why?...
-
Question 26 1 pts The mean volume for a bottle of cologne is 4 ounces and the standard deviation is 0.22 ounces. A random sample of 121 bottles is taken. What is the probability of obtaining a sample...
-
A 5000-KVA 230/13.8-kV single-phase power transformer has a per-unit resistance of 1 percent and a per-unit reactance of 5 percent (data taken from the transformer's nameplate). The open-circuit test...
-
Suppose that the electrical potential at the point (x, y, z) is E(x, y, z) = x + y - 2z. What is the direction of the acceleration at the point (1,3,2)?
-
Locate and read the article listed below and answer the following questions. Alleyne, P., N. Persaud, P. Alleyne, D. Greenidge, and P. Sealy. 2010. Perceived effectiveness of fraud detection audit...
-
What are the basic assumptions that must hold for an auditor to justifiably use analytical procedures as a substantive audit procedure?
-
Audit committees are an important corporate governance party and have taken on additional responsibilities following the passage of the Sarbanes-Oxley Act. a. Describe the changes in audit committee...
-
Cookie Creations is gearing up the winter holiday season. Natalie has had a busy month of December. She needs to journalize and post the month's transactions and complete the accounting cycle,...
-
In her business, Monica Zapata uses a journal with the following columns: Date, Account Title, Check No., Cash Debit, and Cash Credit. Ms. Zapata's husband, Rodrigo, suggests that she needs three...
-
Justin Harris started a small merchandising business in 2006. The business experienced the following events during its first year of operation. Assume that Harris uses the perpetual inventory system....
Study smarter with the SolutionInn App