Generate a list of random numbers

Assignment Help Business Management
Reference no: EM131406484

Part 1:  Generate a list of Random Numbers

Write a program in Python that generates 20 random numbers and stores them in a list. The program should store the numbers in an array.  Use the list using the built-in functionality of the print functions.  Your output should look like this:

[22, 47, 71, 25, 28, 61, 79, 57, 89, 3, 29, 41, 99, 86, 75, 98, 4, 31, 22, 33]

Next, write a function that has the list as a parameter, and displays these statistics. Use the built-in min, max, sum, and len functions.

  • The lowest number
  • The highest number
  • The sum of the numbers

The output should look similar to  this:

Highest: 89
Lowest: 3
Sum: 482
Average: 48.2

Part 2: Prime Numbers List

For each number in your list, test to see if it is prime using the is_prime() function you wrote in the Prime Numbers lab.   If the number is prime, add it to a new list and delete it from the original list.   You'll end up with two lists: one with prime numbers and one with non-primes.   Put a test in your code to sum the length of the two lists to be sure there are still 20 numbers in total.    Now sort both lists with the built-in sort() function, then print them out.   Your output should be similar to this:

Primes:  [47, 71, 61, 79, 57, 89, 3, 29, 41, 31]

Non-primes:  [22, 25, 28, 99, 86, 75, 98, 4, 22, 33]

Reference no: EM131406484

Questions Cloud

Research paper on computer programming : Research Paper on computer programming, different coding languages and their impact on the Technology field.
Options for improving the security : A firm is considering two options for improving the security of its employee accounts from remote compromise. The firm calculates that the probability of compromise without enacting any additional security measures is 0.5, and that successful atta..
Why does it provide a relatively poor hedge : Explain how a stop-loss hedging scheme can be implemented for the miter of an out-of-the-money call option. Why does it provide a relatively poor hedge?
Discuss the overview of network security fundamentals : They provide you with the following report outline to use: Introduction and Overview of network security fundamentals, security threats, and issues (discuss from a companywide standpoint)
Generate a list of random numbers : Write a program in Python that generates 20 random numbers and stores them in a list. The program should store the numbers in an array. Use the list using the built-in functionality of the print functions. Your output should look like this:
What is the 5-day 99% value at risk for the portfolio : Consider a position consisting of a 8100,000 investment in asset A and a 5100.000 investment in asset B. Assume that the daily volatilities of both assets arc I% and that the coefficient of correlation between their returns is 0.3. What is the 5-d..
Information and prints a payroll statement : Write a program with Python that reads the following information and prints a payroll statement:
What is the 5-day 95% value at risk for the portfolio : Assume that the daily volatilities of the assets are 1.8% and 1.2%, respectively, and that the coefficient of correlation between their returns is 0.3. What is the 5-day 95% value at risk for the portfolio?
What kinds of sources do you plan to use for research : What kinds of sources (for example, company website, annual report, government websites, and library articles) do you plan to use for research?

Reviews

Write a Review

Business Management Questions & Answers

  Inverse demand curves for the drug dealers

The inverse demand curves for the drug dealers is: p = 0.25 - q /1200, and for the ordinary conumers is: p = 0.15-q / 6000. SmacFone's marginal and average total cost of service is 0.05 dollar per minute.

  Describe alina leadership style

Alina is the leader of a small group. She is usually considerate, encouraging, and engaged with the other members of the group and the decisions that are made. Occasionally though, she lets the group make decisions without her. Alina's leadership ..

  Southgate hospital accident & emergency department

Southgate Hospital Accident & Emergency Department (A&E) provides a point of entry in to the hospital for patients. Patients can arrive through 2 routes: they can arrive via their own transportation or they can be brought in by ambulance. On entry to..

  Provide a clear and concise summary of the given article

Provide a clear and concise summary of the article, including the major points and conclusions. How the cited work relates to your above explanation AND how it relates specifically to the content of the assigned module/week.

  Describing trusted brands

Compare a brand that you think has broken its brand promise to its customers to the trusted brand that you think keep their promise to their customers.

  Evaluate amazon business strategy

Standing in the year 2000, evaluate Amazon's business strategy. What are its key elements? Is it sustainable?  Discuss the merits and shortcomings, if any, of Ravi Suria's assessment of Amazon's financial situation, given the information available ..

  Analysis the required sample size needed to estimate dollars

Analysis the required sample size needed to be able to estimate the mean dollars that each card holder will spend each month

  Develop a stress management seminar for the employees

Imagine you are a new employee in a human resource (HR) department. Your first task is to develop a stress management seminar for the employees. Determine the topics that should be covered in the seminar.

  Structure for a chinese american bank

What is the appropriate corporate structure for a Chinese American Bank based in California? centralized or decentralized and why?

  Examples of projects that suffered from scope creep

Perform some outside research and find  two examples of  projects that  suffered from scope creep. Try to determine why they suffered scope creep. Use specific actions, tools, or techniques discussed in this chapter that could have helped prevent ..

  Two dogs bites into the world market: focus on japan

On a cool winter day in Adelaide, South Australia, a city with a population of 1.1 million, Duncan MacGillivray found himself in a conversation with his neighbour who had too many lemons for which he was trying to find a use.  MacGillivray, who  owne..

  Connection oriented service versus a connectionless service

What difference does it make to the network layer if the underlying data link layer provides a connection oriented service versus a connectionless service?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd