Question: Please Answer in python codeblock Write a snippet of code that asks the user for a positive integer. To keep things simple, you may assume
Please Answer in python codeblock
Write a snippet of code that asks the user for a positive integer. To keep things simple, you may assume that the user will indeed type a positive integer, and not a negative value or any string that is otherwise not an integer. Add the user's input to an initially empty list. Repeatedly ask for an integer until you have added the user's input 7 times to a list. (Do not convert the input to ints just yet.)
Since the input function in Python takes in strings, you will want the list of user-inputted values to be converted to integers. Do so using list comprehension. Create a new list that applies the int function to all of the elements in the original, thereby creating a separate list of integers that are, indeed, integers and not strings.
After using list comprehension to perform the conversion, determine the maximum and minimum values of the list as well as the average. Print these values to the screen.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
