Your task is to create a Python program that creates a list of 1,000 random integers and
Question:
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.
Principles Of Information Security
ISBN: 9780357506431
7th Edition
Authors: Michael E. Whitman, Herbert J. Mattord