SECTION NO SIGNATURE 3) (22 Pts) Write a program using while loop to generate random integers...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
SECTION NO SIGNATURE 3) (22 Pts) Write a program using while loop to generate random integers in range [1,45]. Display all generated numbers. When the number is 25 (check the condi- tion with rounding function fix()), stop the operation if total number of gener- ated elements is higher than 20 and print the total number of generated elements as: 'The no. of generated elements = ... The end of your output should appear similar to output shown on the right. 40.1997 43.2088 25.0775 The no. of generated elements = YOUR ANSWER: 62 SECTION NO SIGNATURE 3) (22 Pts) Write a program using while loop to generate random integers in range [1,45]. Display all generated numbers. When the number is 25 (check the condi- tion with rounding function fix()), stop the operation if total number of gener- ated elements is higher than 20 and print the total number of generated elements as: 'The no. of generated elements = ... The end of your output should appear similar to output shown on the right. 40.1997 43.2088 25.0775 The no. of generated elements = YOUR ANSWER: 62
Expert Answer:
Answer rating: 100% (QA)
import random Initialize variables generatedelements 0 Start generating random integ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
In this problem, you will create a program from scratch based to demonstrate your abilities to create and manipulate lists in Python. Create a file named Lab05P3.py . For this program: Label each...
-
Lab6B: Pick a number between 1 and 1000 For this lab, make sureto please use a while loop. Many programming languages have alibrary for a Random Number Generator (RNG). Whenever this RNG isused it...
-
1. What options does Personal Trainer have for developing a new system? What are some specific issues and options that Susan should consider in making a decision? 2. Susan has been asked to prepare a...
-
Explain why the payoff from a call option is non-linear.
-
Graph the solution set of the inequality, where x is an integer, on the number line. 3(x + 4) 4x + 13
-
In the past five years, there have been significant innovations in technology such as smartphones and tablets. Technology companies rely on intellectual property (IP) rights, such as patents,...
-
Wal-Mart Stores (Walmart) is the worlds largest retailer. It employs an everyday low price strategy and operates stores as three business segments: Wal-Mart Stores U.S., International, and Sams Club....
-
Fort Gaines guards the western entrance to Mobile Bay. In order to prevent enemy ships from passing, it needs to be able to cover about 1 km of the bay with cannon fire. The cannons fire projectiles...
-
Given the information below on peer companies A-D, calculate the beta for company E if it has net debt/equity of 0.65 and a tax rate of 35%. Company Beta Net debt / equity tax rate A 1.25 1.15 35% B...
-
Alfa bakery is considering replacing its existing automated oven. The current market value of the oven is $12,000. The value of the oven depreciates by 25% per year. The generator produces 36 cakes...
-
Anna would like to purchase $50,000 of dividend paying common shares in various Canadian public corporations. Anna is considering whether she should acquire the stock portfolio personally or via her...
-
First, you will describe what happens in the commercial. Assume that the reader has not seen it. Explain the use of words, images, and sounds. What do you see? Next, use the premises-conclusion...
-
How are Fringe benefits treated in a partnership? How are Group Insurence and Health savings accounts treated in a partnership?
-
Under the public interest theory, the government intervenes in the operations in various market in response to market failure and in public interest. From the statement above, discuss what you...
-
Create your own company (Manufacturing/Hypermarket/Car Showroom/Perfume showroom/Electronics Export and Import etc.,) and answer the following three questions? Write the Introduction of the Company...
-
Medi-Exam Health Services, Inc. (MEHS), located in a major metropolitan area, provides annual physical screening examinations, including a routine physical, EKG, and blood and urine tests. MEUS's...
-
Determine the solution of the following differential equation that satisfies the given initial conditions. Plot the solution for 0 < t < 7. 0.08 +0.61 = 0, y(0) = 2, ay gdy = 3 dx x-0 %3D %3D %3D dr
-
The net heat exchange by radiation from plate 1 with radius b to plate 2 with radius a that are separated by a distance c is given by: q = b2F12(T41 T42) Where T1 and T2 are the absolute...
-
Show that = 4/3 Do this by first creating a vector x that has the elements 2.0, 1.5, 1.1, 1.01, 1.001, 1.00001, and 1.0000001. Then, create a new vector yin which each element is determined from the...
-
Based on the photographs in Figure 26.13, in which segment(s) is the Antp gene normally expressed? Figure 26.13: (a) Normal fly (b) Antennapedia mutant
-
The bush baby, a small African mammal, is a remarkable jumper. Although only about 8 inches long, it can jump, from a standing start, straight up to a height of over 7 feet! Use the particle model to...
-
Hicham El Guerrouj of Morocco holds the world record in the 1500 m running race. He ran the final 400 m in a time of 51.9 s. What was his average speed in mph over the last 400 m? A. 14.2 mph B. 15.5...
Study smarter with the SolutionInn App