Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your task is to create a Python program that creates a list of 1,000 random integers and then provides the user with some descriptive statistical

Your task is to create a Python program that creates a list of 1,000 random integers and then provides the user with some descriptive statistical information about the list. This is an exercise in working with lists, working with random numbers, and doing some simple numerical analysis of a list of numbers. 

 

Write and submit a program that does the following: 

1. Create an empty Python list 

 

2. Create a count-controlled while loop to generate and append 1,000 random integers to the list. Each integer should be between 1 and 100, including 1 and 100 

  

3. Use the for statement to iterate the list, and calculate 

1. the sum of the values in the list. 

2. the minimum of the values in the list. 

3. the maximum of the values in the list. 

4. the average of the values in the list. 

 

Your software should not use the Python Max or Min functions for lists. You should be able to write your own code to iterate the list and find the maximum and minimum values. 

 

Before the loop starts, set the maximum to a number lower than anything in the list. As you iterate the list, if the current list value is higher than the maximum, it becomes the new maximum. When the loop is done, maximum will be the highest value. 

 

Before the loop starts, set the minimum to a number higher than anything in the list. As you iterate the list, if the current list value is lower than the minimum, it becomes the new minimum. When the loop is done, minimum will be the lowest value. 

 

Before the loop starts, set the sum to a zero. As you iterate the list, add the current value to the sum. The sum will be like a "running total" as the loop progresses. When the loop is done, sum will be sum of all numbers in the list. 

 

You should be able to do get the maximum, minimum, and sum with a single loop, followed by a statement to find the average, and then print statements to show the results. The statement to find the average should use the list length function, not the number 1,000, which means it should work no matter how many numbers are in the list. 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Heres a Python program that follows your instructions to create a list of 1000 random integers and p... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of Information Security

Authors: Michael E. Whitman, Herbert J. Mattord

7th Edition

035750643X, 978-0357506431

More Books

Students also viewed these Programming questions