3. Write a Python script, Lab02_03.py that does the following: a. Uses a for loop to...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
3. Write a Python script, Lab02_03.py that does the following: a. Uses a for loop to calculate and display the first 10 powers of 2. b. Uses a while loop to find the first power of 2 greater than 5000. Sample Run: 2 to the power 1 is 2 2 to the power 2 is 4 2 to the power 3 is 8 2 to the power 4 is 16 2 to the power 5 is 32 2 to the power 6 is 64 2 to the power 7 is 128 2 to the power 8 is 256 2 to the power 9 is 512 2 to the power 10 is 1024 First power of 2 > 5000 is 2 to the power 13 which is 8192 3. Write a Python script, Lab02_03.py that does the following: a. Uses a for loop to calculate and display the first 10 powers of 2. b. Uses a while loop to find the first power of 2 greater than 5000. Sample Run: 2 to the power 1 is 2 2 to the power 2 is 4 2 to the power 3 is 8 2 to the power 4 is 16 2 to the power 5 is 32 2 to the power 6 is 64 2 to the power 7 is 128 2 to the power 8 is 256 2 to the power 9 is 512 2 to the power 10 is 1024 First power of 2 > 5000 is 2 to the power 13 which is 8192
Expert Answer:
Answer rating: 100% (QA)
Heres the Python script Lab0203py that meets the requirements a ... View the full answer
Related Book For
Integrated Accounting
ISBN: 978-1285462721
8th edition
Authors: Dale A. Klooster, Warren Allen, Glenn Owen
Posted Date:
Students also viewed these programming questions
-
Write a matlab code that does the following coordinates [2,1; 3,1;4,5;2,3; 4,3] (this is just an example and the code must be able to handle all such distances)The code should be a function that...
-
Write a Python script to display the value of Golden Ratio.
-
Write a Python script that converts from Celsius to Fahrenheit, printing a table showing conversions for integer values between a minimum and a maximum both specified by the user. For example, if the...
-
Lionel Train Company has the following information for this year and next year. Current Next Year Year Trains purchased 40,000 48,000 Trains scrapped in production 4,000 3,000 Trains sold 36,000...
-
Suppose that a biotech firm in Pittsburgh raised $120 million in an IPO. The firm received $23 per share, and the stock sold to the public for $25 per share. The firms legal fees, SEC registration...
-
A block with mass m =6.8 kg is hung from a vertical spring. When the mass hangs in equilibrium, the spring stretches x = 0.22 m. While at this equilibrium position, the mass is then given an initial...
-
The press consists of two rigid heads that are held together by the two A-36 steel 1/2 -in.-diameter rods. A 6061-T6 solid aluminum cylinder is placed in the press and the screw is adjusted so that...
-
Alan Gellen is the facilities manager for the city of Milwaukee and makes all final decisions on purchasing items such as chairs, lights, and other supplies and materials. Alan also makes the final...
-
Norma Electronics sell its products for cash and on credit. It usually provides 6 % of its credit sales as allowance for bad and doubtful debts. In the month of April 2 0 x 1 , Norma Electronics...
-
The Ploughman family owns and operates a 640-acre farm that has been in the family for several generations. The Ploughmans always have had to work hard to make a decent living from the farm and have...
-
An administrative assistant is hired after graduating from high school and learns to type on the job. The number of words he can type per minute is given by where t is the number of months he has...
-
A 1 4 5 lb person is in an elevator accelerating downwards at 2 ft / s 2 . How much does the person feel like they weigh during this motion? ( FN = 1 3 6 lbs )
-
A spring gun with spring constant 4 N / m is compressed 2 meters from its natural length and then shoots a ball of 0 . 0 1 kg . What is the speed of the ball out of the gun ( in m / s ) ?
-
1. What are the main risk factors that the firm faces? 2. What happened to revenues and same-store sales in 2017? Briefly discuss the principal factors that affected the company's revenues and...
-
Consider the diversity at your current (or last) company. Does it reflect predictions about the future of the workplace? Describe what you think should be done (if anything) to better reflect such...
-
1 points On a certain road, a car can decelerate at a rate of 7.02 m/s2. Find the distance necessary to stop a car moving at 27.4 m/s. Maintain the same system of units. Normal format and 3 SF.
-
Petrock Company provided the following information at year-end 2016 Ordinary share capital 90,000 shares Convertible preference share capital 10,000 shares 2017 90,000 shares 10,000 shares During...
-
Why is disclosure of depreciation or amortization methods and rates so important?
-
How does the computer determine the value of the inventory based on average cost as shown in the average cost inventory valuation report?
-
What financial statements are available for a non departmentalized business organized as a sole proprietorship?
-
How does the computer know what check numbers to assign to current payroll checks?
-
What is the difference between a firm's gross profit margin, operating profit margin, and net profit margin?
-
Last year, Token Corporation reported \($1,230,000\) in sales with a cost of goods sold of \($520,000,\) and operating expenses of \($440,000.\) The increase in the firms retained earnings was...
-
In 2019, Italia Mining Corporation had sales of \($69\) million, total assets of \($45\) million, and total liabilities of \($23\) million. The interest rate on the debt is 6.5 percent, and its tax...
Study smarter with the SolutionInn App