0

how do i generate the maximum and minimum values entered by a user when i ask the user to input five integers

27th Jul 2016, 2:41 PM
Elijah Arhinful
Elijah Arhinful - avatar
4 odpowiedzi
+ 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.
27th Jul 2016, 4:16 PM
sundar
sundar - avatar
+ 1
list=[input1,input2,input3,input4,input5] #for man value max_value=max(list) #for min. value min_value=min(list)
27th Jul 2016, 3:58 PM
Mohamed Haggag
Mohamed Haggag - avatar
0
ok.. sundar...thanks
27th Jul 2016, 4:22 PM
Elijah Arhinful
Elijah Arhinful - avatar
0
i'll try it
27th Jul 2016, 4:22 PM
Elijah Arhinful
Elijah Arhinful - avatar