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...
-
What did Newton discover about gravity?
-
The following is a December 31, 2018, post-closing trial balance for Almway Corporation Additional Information: 1. The investment account includes an investment in common stock of another corporation...
-
Jill Catanac, purchased a new laptop computer just before this school term for \(\$ 300\). Shortly after the semester began, her new computer was damaged when it was accidentally dropped. Returning...
-
Daily samples of 100 power drills are removed from Drill Master's assembly line and inspected for defects. Over the past 21 days, the following information has been gathered. Develop a 3 standard...
-
Itwas a Fridaynight,andyouwere sittingalone insome IrishbaronCrescentStreet.Montrealwas still Montreal, yetyourlife wasn'tas easyas itwas whenyouwere a student.Theloudmusiccouldn'tcheer youup.Allyou...
-
The Columbia River Crossing (CRC) project is in-tended to improve traffic flow in the I- 5 corridors in the greater Vancouver, Washington, and Portland, Oregon, region. The proposed project is...
-
Current Attempt in Progress Faculty Salary and Completion Rate The CompRate variable in CollegeScores4yr records the percentage of students at each four-year school who graduate within six years...
-
- The Long Term Care Plus Company has two service departments actuarial and premium rating, and two operations departments marketing and sales. The distribution of each service department's efforts...
-
There is the following information ( Monthly P&L ) for Honey's Motel, which has two types of rooms: single and double type. Price per room and variable costs per room for each type of room (Single...
-
Muronga Ltd supplied the following details regarding a contract that was still in progress at the end of the accounting period ended 29 February 2019: Contract price N$100 000 Cost to date N$60 000...
-
Rodolfo is a 25-year-old Italian citizen who is in the United States on vacation. He speaks very little English. During one night while he was out celebrating a friend's birthday, Rodolfo drove his...
-
Define customer service excellence and its significance in achieving customer satisfaction as it relates to (business chosen). Who are the internal and external customers and how does customer...
-
Broussard Skateboard's sales are expected to increase by 20% from $8.4 million in 2019 to $10.08 million in 2020. Its assets totaled $5 million at the end of 2019. Broussard is already at full...
-
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...
-
Are there any limits to how little inventory a company should carry? Is it possible to entirely eliminate all inventories?
-
How can innovative uses of IT to perform expenditure cycle activities also be used to improve the efficiency and effectiveness of suppliers revenue cycle activities? Why might a company wish to help...
-
George Edmonds, the new accountant for Zigler Company, has recommended the preparation of income statements reporting contribution margin rather than statements reporting gross profit. He states that...
Study smarter with the SolutionInn App