4. Write a program that makes both a list L and a tuple T with the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
4. Write a program that makes both a list L and a tuple T with the following values: a) The numbers 1 to 100, inclusive. b) The odd numbers from 1 to 101, inclusive. c) The squares of numbers from 0 to 49, inclusive d) 60 random integers from 0 to 49, where you import random and use random.randrange(0, 50) to get each value. e) 50 zeroes, i.e., [0, 0, ...., 0] and (0, 0, ..., 0). Note, you can use repetition, as you would for a string. Do not use list comprehension for this question. 5. Repeat Question 4, but this time use list comprehension, and you can skip the tuple part. 4. Write a program that makes both a list L and a tuple T with the following values: a) The numbers 1 to 100, inclusive. b) The odd numbers from 1 to 101, inclusive. c) The squares of numbers from 0 to 49, inclusive d) 60 random integers from 0 to 49, where you import random and use random.randrange(0, 50) to get each value. e) 50 zeroes, i.e., [0, 0, ...., 0] and (0, 0, ..., 0). Note, you can use repetition, as you would for a string. Do not use list comprehension for this question. 5. Repeat Question 4, but this time use list comprehension, and you can skip the tuple part.
Expert Answer:
Answer rating: 100% (QA)
4ans import random La listrange1 101 Ta tuplerange1 101 Lb num for num in range1 102 ... View the full answer
Related Book For
Linear Algebra And Its Applications
ISBN: 9781292351216
6th Global Edition
Authors: David Lay, Steven Lay, Judi McDonald
Posted Date:
Students also viewed these programming questions
-
Microkernel operating systems aim to address perceived modularity and reliability issues in traditional "monolithic" operating systems. (i) Describe the typical architecture of a microkernel...
-
An algorithm has been written in pseudocode to input some numbers. It only outputs any numbers that are greater than or equal to 100. The number 999 is not output and stops the algorithm. INPUT...
-
Need assistance on adding accounting info to the excel worksheet posted. A.) would 97,400 go under cash or fixed assets ? Number Styles Cells Editing Ideas g Cash Balance B. C D E H. K M T. 0,1,F...
-
You have a business that requires the replacement of two 50,000- BTU heating units. Compare the total costs of these units from three manufacturers. Assume that the heaters will be placed in use and...
-
Which the following factors would impact a buyer's reservation price for a given good or service: social influence, the price of the good, or the cost of producing the item?
-
You have collected the following data: If you randomly select one of these 10 numbers, what is the probability the number (X) will be ... a. equal to 4 ? b. equal to 7 ? c. less than 5 ? d. greater...
-
The 2008 annual report for HCA, Inc., a nationwide chain of hospitals, contains the following statement in the footnotes to the financial statements: We operate in a highly regulated and litigious...
-
One of Andrew and Cynthia's goals is to buy a bigger house. Since mortgage rates have fallen significantly, they want to look into purchasing the home earlier than expected. Cynthia will also receive...
-
Van Auken Lumbers annual income statement. Van Auken Lumber: Income Statement for December 31, 20xx ($ thousand) Sales $36,000 Cost of Goods Sold (25,200) Gross Profit $10,800 Fixed Operating costs...
-
The following facts relate to McKane Corporation. 1. Deferred tax liability, January 1, 2015, \($60\),000. 2. Deferred tax asset, January 1, 2015, \($20\),000. 3. Taxable income for 2015,...
-
The following two independent situations involve litigation provisions. Part 1: Benson Company sells two products, Grey and Yellow. Each carries a one-year warranty. 1. Product GreyProduct warranty...
-
Telephone Sellers Inc. sells prepaid telephone cards to customers. Telephone Sellers then pays the telecommunications company, TeleExpress, for the actual use of its telephone lines related to the...
-
Wynn Company offers a set of building blocks to customers who send in 3 UPC codes from Wynn cereal, along with 50. The blocks sets cost Wynn $1.10 each to purchase and 60 each to mail to customers....
-
Presented below is a note disclosure for Matsui Corporation. Litigation and Environmental: The Company has been notified, or is a named or a potentially responsible party in a number of governmental...
-
Refer back to the beginning of this chapter to the excerpt from a Los Angeles Times article about Reed Slatkin's fraud. The article insinuates that the FBI and IRS's raiding of Slatkin's office...
-
What are the four types of poultry production systems? Explain each type.
-
Let B = {b 1 , b 2 } and C = {c 1 , c 2 } be bases for R 2 . In each exercise, find the change-of-coordinates matrix from B to C and the change-of-coordinates matrix from C to B. b = [3]. 12 b2 = [1]...
-
Mark each statement. Justify each answer. (T/F) If S = {x}, then aff S is the empty set.
-
Write a formula for a linear functional f and specify a number d, so that [f : d] is the hyperplane H described in the exercise. Let H be the column space of the matrix That is, H = Col B. B = 1 4 -7...
-
Why is macroeconomic forecasting so difficult? Does this difficulty mean economics is a worthless field of study?
-
Which of the following statements are positive in nature and which are normative? a. A tax cut will raise interest rates. b. A reduction in the payroll tax would primarily benefit poor and...
-
Graph the behavior of the civilian unemployment rate from 1961 until the present using monthly data. Can you see the periods of recession that occurred in 19691970, 19731975, 1980, 19811982,...
Study smarter with the SolutionInn App