Generate a list of random numbers

Assignment Help Basic Computer Science
Reference no: EM131405754

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: EM131405754

Questions Cloud

Which currency is used the most in international invoices : MGT 520- Which currency is used the most in international invoices? On what unit of analysis did the first theories of international trade focus? The first theories of international trade are referred to as _____.
Determining the messaging servers : You were hired as a Consultant for a Medium size organization. They operate a Microsoft Exchange Messaging Server. They have 5 functional departments. Among them are Sales and Accounts Receivables.
Discuss the organizations culture and its climate : Describe how these are evidenced-or perhaps appear to be contradicted-in the words and actions of leaders and others in the organization, noting relevant data or artifacts. In addition, discuss the organization's culture and its climate, different..
How each leadership style might affect the performance : Analyze how each leadership style might affect the respective company's performance and alignment to values. Discuss which leadership style to which you are most aligned.
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:
Are jesus-views on wealth practical and helpful : Jesus often spoke critically about material possessions and the wealth. He even directed one person to give away all his wealth to the poor before following him. Are Jesus/ views on wealth practical and helpful or impractical and potentially harmf..
Do you exhibit the right company culture every day : Think of your own actions at work. Do you exhibit the right company culture every day? In other words, do you walk the walk and talk the talk?
Information and prints a payroll statement : Write a program with Python that reads the following information and prints a payroll statement:
Displays the future investment value : Write a program in Python that reads in investment amount, annual interest rate, and number of years, and displays the future investment value using the following formula:

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Testing is so essential to the development of a new system

Discuss why testing is so essential to the development of a new system; list the different types of testing that can be completed and why each one is critical. Can testing be overlooked to speed up the development effort?

  Secure assets on wwtc network

1. Physical layer: Door locks, Smart card, HVAC, CCTV, Guards, Remote backup facilities and etc. 2. Roles of devices for ISO layer 2: Switches will be needed 3. Next layer is securing ISO level 3: Routers will needed and VPN

  Determine the funds received and use the text to column

In this project, you will be assigned the task to record money received for a school fundraiser and create an Excel spreadsheet to record your receipts. You will determine the funds received and use the text to column feature

  Swift 3 ios iphone app

Using Swift 3 iOS iPhone App Create a simple application that gathers the following personal information:

  What is the radius of the top and the base of the tower

If the tower is 450 feet tall, the top is 100 feet above the center of the hyperbola, and the base is 350 feet below the center, what is the radius of the top and the base of the tower?

  Compute odds ratio estimates comparing scab vs. sprout

Compute odds ratio estimates comparing scab vs. sprout corresponding to the variables referenced in (a). Compute confidence intervals and interpret these intervals in the context of the data.

  . what options does atrium have for acquiring a new system

Atrium Bio-Medical Supply is a medium sized regional supplier of medical and laboratory equipment.Since starting 12 years ago,Victoria Dawn has built Atrium into a competitive supply company across several metro areas,but her growth potential is l..

  Deletion and modification of a record

Describe the static hash file with buckets and chaining and show how insertion, deletion and modification of a record can be performed.

  Determine the rates of heat addition and rejection

Assuming both the compressor and the turbine to be isentropic, determine the rates of heat addition and rejection for this cycle when it produces 115 kW. Use constant specific heats at room temperature.

  Prudent level of debt will protect companies

Research "prudent level of debt" for one of the following companies: Hershey Foods, Verizon, AT &T or EG&G. Discuss how a prudent level of debt will protect companies from financial distress and ensure access to money and capital markets under mos..

  Disengaged from the organization

For this SLP, you will write a paper describing why you or someone you know has been disengaged from the organization. You will provide specific examples throughout your paper. Furthermore, you will discuss solutions for each issue that you discus..

  Write a graphics program that draws 12 strings

Write a graphics program that draws 12 strings, one each for the 12 standard colors, besides Color.WHITE, each in its own color. Provide a class ColorNameViewer and a class ColorNameComponent.

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