The program below adds three user-entered numbers to the values list. Where shown by the comments, add code to process the list as follows:
Using the appropriate list function, find the smallest value in the list. Print the message "Min: X", where X is the smallest value.
Using the appropriate list function, find the largest value in the list. Print the message "Max: X", where X is the largest value.
Using the "in" keyword, if the value 5 is in the list, print the message "5 was entered".
The following examples demonstrate the expected program output.
Enter a value: 10
Enter a value: 20
Enter a value: 30
Min: 10
Max: 30
Processing complete
Enter a value: 5
Enter a value: 10
Enter a value: 15
Min: 5
Max: 15
5 was entered
Processing complete
values = []
for i in range(0,3):
value = int(input("Enter a value: "))
values.append(value)
#student code here
print("Processing complete")
1 answer
for i in range(0,3):
value = int(input("Enter a value: "))
values.append(value)
# student code here
# Find the smallest value in the list
smallest = min(values)
print("Min:", smallest)
# Find the largest value in the list
largest = max(values)
print("Max:", largest)
# Check if 5 is in the list
if 5 in values:
print("5 was entered")
print("Processing complete")