Sum up all the integers from 2 to 77 with a for loop by filling in...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Sum up all the integers from 2 to 77 with a for loop by filling in the blank in the code snippet below: sum = 0 for i in range ( sum = sum + i type your answer here Modify your code from the above problem. Instead of using a for loop, use a list comprehension. Use the variable i as the indexer in the list comprehension and apply the function sum() to the list. Provide your code as the answer. i = [i for i in range(2,78)] sum= sum + i Submit Wrong Answer Submit Modify your code from the above problem. Sum up the squares of the integers instead of just the integers. What is the result? You are given the lambda function of the following form: func = lambda x: 8***(***2 5). What is the result of func(4) ? type your answer here Modify the Lambda function above such that it multiplies not by 8, but by 3. Put into the answer box the Python code to save the result in the variable func2. type your answer here Submit type your answer here You are given two lists: [30, 37, 24, 38] and [28, 39, 34, 20]. Using the zip() function, write a list comprehension that computes the ratio of the elements of list1 and list2. Use the variable names 11 and 12 for the elements in the list comprehension. Consider the list Submit Submit [12, 6, 9, 6, 7, 10, 9] Using a list comprehension, add one to each element and then multiply each element by 2. Put in the answer box how you would write the list comprehension. Use the underscore () as the placeholder for the iterator. If your answer is marked as incorrect, try a different order, e.g., (+1) instead of (1+_). Sum up all the integers from 2 to 77 with a for loop by filling in the blank in the code snippet below: sum = 0 for i in range ( sum = sum + i type your answer here Modify your code from the above problem. Instead of using a for loop, use a list comprehension. Use the variable i as the indexer in the list comprehension and apply the function sum() to the list. Provide your code as the answer. i = [i for i in range(2,78)] sum= sum + i Submit Wrong Answer Submit Modify your code from the above problem. Sum up the squares of the integers instead of just the integers. What is the result? You are given the lambda function of the following form: func = lambda x: 8***(***2 5). What is the result of func(4) ? type your answer here Modify the Lambda function above such that it multiplies not by 8, but by 3. Put into the answer box the Python code to save the result in the variable func2. type your answer here Submit type your answer here You are given two lists: [30, 37, 24, 38] and [28, 39, 34, 20]. Using the zip() function, write a list comprehension that computes the ratio of the elements of list1 and list2. Use the variable names 11 and 12 for the elements in the list comprehension. Consider the list Submit Submit [12, 6, 9, 6, 7, 10, 9] Using a list comprehension, add one to each element and then multiply each element by 2. Put in the answer box how you would write the list comprehension. Use the underscore () as the placeholder for the iterator. If your answer is marked as incorrect, try a different order, e.g., (+1) instead of (1+_).
Expert Answer:
Answer rating: 100% (QA)
1 Sum all integers from 2 to 77 using a for loop python sum 0 for i in range2 78 sum sum i 2 Modify ... 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
-
Assume that a country experiences a financial crisis that causes the nation's financial markets to freeze in a manner that prevents a private firm from raising capital from any source. Explain how...
-
Our discussion of SIC/XE Format 4 instructions specified that the 20-bit "address" field should contain the actual target address, and that addressing mode bits b and p should be set to 0. (That is,...
-
XII. Insufficient Funds A. What is that? B. What does the bank do? C. How do you handle this in QBO? 1. Create two service items: Describe why we use these? a) Bounced Check Amount - (1) What income...
-
Here is the end-of-year account balance information from the accounting records of Jaunty Coffee Company: Sales revenue Cash Cost of goods sold Accounts payable Capital stock Dividends Retained...
-
A luminous object 3.0 mm high is placed 20.0 cm from a convex mirror of radius of curvature 20.0cm. (a) Show by ray tracing that the image is virtual, and estimate the image distance. (b) Show that...
-
Other than increasing the company's equity what would be another potential business decision could be to increase the company's equity financing?
-
What is it about postsale follow-up that makes it one of the most important ways to enhance long-term customer relationships? What specific things can you do in follow-up to accomplish this?
-
Consider Mila Fashion from S8- 5. Assume once again that all fixed costs are unavoidable. If the company discontinues one of the current departments, it plans to replace the discontinued department...
-
In 2019, Rylan Enterprises' net income increased by $2.5 million while its depreciation expense decreased by $500,000, accounts receivable increased by $2,000,000 and accounts payable increased by...
-
Given this, answer the following questions: 1. Draw a diagram of the process using the format in Exhibit 7.3. 2. Consider a base case where a customer arrives every 40 seconds and the Customer...
-
12. MS-EXCEL can be used to automate A) Financial statements, Business forecasting B) Transactionregisters, and inventory control C) Accounts receivable, accountspayable D) Any of the above 13. You...
-
Is a person dealing with a corporation expected to know the contents of the corporations articles of incorporation or its bylaws?
-
What is correspondent banking? Explain why this function has diminished in importance.
-
What is inside information? How is it relevant to the efficient market hypothesis?
-
What do you understand by repurchase agreements? Explain how banks use repurchase agreements as a source of business funds in the financial market.
-
How does the use of collateral help to reduce the problem of adverse selection?
-
Which of the following statements is false for a particle in aone - dimensional box with infinite walls at x = 0 and x = L a. The probability of finding the particle in the left - handhalf of the box...
-
The following data are supplied for the common stocks of Nikola Corporation, Tesla, Inc. and General Motors: Nikola Corp (NKLA) Tesla Inc. (TSLA) Close Price ($) Close Price ($) 67.53 30.00 40.81...
-
Your supervisor has asked you to research the following situation concerning Owen and Lisa Cordoncillo. Owen and Lisa are brother and sister. In May 2012, Owen and Lisa exchange business pickup...
-
Joan is a self-employed attorney in New York City. Joan took a trip to San Diego, CA, primarily for business, to consult with a client and take a short vacation. On the trip, Joan incurred the...
-
In 2012, Michael has net short-term capital losses of $2,000, a net long-term capital loss of $45,000, and other ordinary taxable income of $45,000. a. Calculate the amount of Michael's deduction for...
-
A hiker is helping a friend up a hill that makes an angle of \(30^{\circ}\) with level ground. The hiker, who is farther up the hill, is pulling on a cable attached to his friend. The cable is...
-
While designing a conveyor belt system for a new airport, you determine that, when a typical suitcase is moving up an incline of \(20^{\circ}\), the magnitude of the maximum forward acceleration a...
-
In the diagrams in Figure 10. 22, the velocity of an object is given along with the vector representing a force exerted on the object. For each case, determine whether the object's speed increases,...
Study smarter with the SolutionInn App