0
how do i generate the maximum and minimum values entered by a user when i ask the user to input five integers
4 Respuestas
+ 2
numlist = []
for i in range(0,10):
numbers=int(input("Enter the numbers: ")
numlist.append(numbers)
print("maximum number is", max(numlist))
print("minimum number is", min(numlist))
This program will get user input for 10 times and append it to an empty list we created earlier.
finally using min() and max() functions you can find the minimum and maximum number from that list
Note: This will not work in sololearn playground. since the environment has some limitations in getting user inputs, but it'll work in real python environment.
+ 1
list=[input1,input2,input3,input4,input5]
#for man value
max_value=max(list)
#for min. value
min_value=min(list)
0
ok.. sundar...thanks
0
i'll try it