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

  Serving the hit market

Compare and contrast two companies that serve the HIT (Health Information Technology) market when a health care organization needs to turn to the market for applications, infrastructure, or services (for example, McKesson, Cerner, Siemens, CSC, P..

  Describes the functions display list and replace

describes the functions display List and replace.

  What personal and organizational solutions

Create a 8 - 12 slide power point that discusses whether cognitive overload is a problem in work or education. What personal and organizational solutions can you recommend for this problem?

  One function is use to calculate inflation rate for current

1.One function is use to asks the user to enter the current price of an item and it's one year. 2.One function is use to calculate inflation rate for current year.

  Determine the bit representation for each of the following

Determine the bit representation for each of the following for 32-bit floating point notation

  Description of new information technology

.A full description of the new Information Technology (IT) system that you will propose to the Riordan organization during Week Nine of the course - Make sure that the four primary functions of an IT system are evident in the system that you propo..

  Tax and government multipliers

Two identical countries, Country A and Country B, can each be described by a Keynesian-cross model. The MPC is 0.8 in each country.

  Why omitting an input actually describes sequential circuit

explain why omitting an input actually describes a sequential circuit

  Different versions of a single operating system

Name several operating systems that run LANs today. Do not include different versions of a single operating system. For each operating system, list its name, the platform or network it operates on, and its distributor or manufacturer

  Key ingredient in a business success

As you have stated, " the right location is a key ingredient in a business's success." Please list two factors and explain how they impact service companies' location strategy?

  Describe the direction form and strength of the plot

Write a few sentences telling what the plot says about the data. (Note: The sentences should be about weighing trucks, not about scatterplots.)

  Who developed this algorithm

The evolutionary history of AES differs from that of DES. Briefly describe the differences of the AES history in comparison to DES.

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