Task 3- Add 1000 numbers to a list Now instead of 5 numbers we're going to...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Task 3- Add 1000 numbers to a list Now instead of 5 numbers we're going to do the same thing with 100 random numbers in a list. We will add 100 random numbers to a list and then sort and print them out. First, we need to import the random module so we can generate random numbers import random Then we're going to initialize our variables so the system knows what we're using them for. list=[] index= 0 Then we'll add a loop that will loop through 100 times and append a random number to the list. Use the print(list) command to make sure your program has added the numbers to the list. print(" ") while index < 1000: list.append(random.randint(1,100)) index += 1 print(list) How could you change the program to use 1000 number instead of 100? Change the program to get 1000 random numbers. Run the program again. Could you do the same thing with 10000 numbers? How about 1,000,000? What is the limit for how many numbers you can use in your program? Task 3- Add 1000 numbers to a list Now instead of 5 numbers we're going to do the same thing with 100 random numbers in a list. We will add 100 random numbers to a list and then sort and print them out. First, we need to import the random module so we can generate random numbers import random Then we're going to initialize our variables so the system knows what we're using them for. list=[] index= 0 Then we'll add a loop that will loop through 100 times and append a random number to the list. Use the print(list) command to make sure your program has added the numbers to the list. print(" ") while index < 1000: list.append(random.randint(1,100)) index += 1 print(list) How could you change the program to use 1000 number instead of 100? Change the program to get 1000 random numbers. Run the program again. Could you do the same thing with 10000 numbers? How about 1,000,000? What is the limit for how many numbers you can use in your program?
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Reset all of the assumptions to the original values. Then assess the sensitivity of the impairment test results by changing the following assumptions listed below. Assumption Name: Revised...
-
Timmins Distribution is a large warehousing and distribution company that operates throughout Eastern Canada. Timmins Distribution uses the UOP method to amortize its trucks because its managers...
-
Choiceland has 250 workers and produces only two goods, X and Y. Labour is the only factor of production, but some workers are better suited to producing X than Y (and vice versa). The table below...
-
You are a salesperson for the local cell phone company presenting to the sales manager of a company considering adopting a companywide cell phone provider. Develop a 5-minute product demonstration of...
-
The ledger of Herrera, Inc. on March 31, 2022, includes the following selected accounts before adjusting entries. An analysis of the accounts shows the following. 1. Insurance expires at the rate of...
-
Explain how you plan to gain awareness for your product(soft drink). Discuss your integrated marketing communications (IMC) plans including advertising, sales promotions, public relations, personal...
-
41 Vignette 1 Assault and Battery A student and a staff radiographer were asked to per- form an intravenous pyelogram on a 58-year-old woman with hypertension. The staff radiographer, who was the...
-
What is global leadership and how does it compare to other theories of leadership. Are global leaders born or made?
-
In the above question, What if you are given whole work of OSCAR WILDE, most popular playwrights in the early 1890s. a. Who knows how many books are there, let us assume there is a lot and we cannot...
-
Do men and women have different leadership styles? What are the implications of these differences for organizations?
-
What is the meaning of the relational architecture of jobs and how does it contribute to what is known about job design?
-
What are some of the reasons that wage incentive plans are often ineffective and what can be done to make them more effective?
-
The US Financial Accounting Standards Board does not allow revaluation of non-current assets to fair value, but it does make it compulsory to account for the impairment costs associated with...
-
Which internal control principle is especially diffi cult for small organizations to implement? Why?
-
We revisit our financially afflicted friend, Charlie Plopp. This time we will look at a slightly generalized version of the same problem. All else is as before, but the willingness to pay of...
-
Remember Earl, who sells lemonade in Philadelphia? You met him in the chapter on cost functions. Earls production function is f(x1, x2) = x1/3 1 x21/3, where x1 is the number of pounds of lemons he...
-
The picturesque village of Horsehead, Massachusetts, lies on a bay that is inhabited by the delectable crustacean, homarus americanus, also known as the lobster. The town council of Horsehead issues...
-
Calculate the radius \(R_{S}\) of the orbit of a geostationary satellite using the lunar period, \(T=27.3\) d, and the Earth-Moon distance, \(D_{T L}=3.810^{5} \mathrm{~km}\), as data.
-
Show that in the case of a binary system in which the orbit is circular of radius \(r\), the kinetic energy corresponds to half the absolute value of the potential energy. In other words, the total...
-
Show that the force field expressed in spherical coordinates \(\mathbf{F}=f(r, \theta) \mathbf{r}\) is conservative if and only if the function \(f\) is independent of \(\theta\).
Study smarter with the SolutionInn App