+ 3

A program that reads in three integer numbers the. Prints out the min value and the max value of the three numbers.

4th Oct 2016, 6:31 AM
Brenda Marie Campos
Brenda Marie Campos - avatar
6 Réponses
+ 5
x=[int(i) for i in input().strip().split()] print("max is",max(x),"and min is",min(x)) this would read input as 3 5 7 3 4 1 in one line and this is not limited just for 3 inputs output would be displayed as max is 7 and min is 1
11th Oct 2016, 1:38 PM
Sunera
Sunera - avatar
+ 2
Previous two answers are good, except you could use string formatting: print("Minimum is {0}, and maximum is {1}.".format(0 = min(list1), 1 = max(list1)))
4th Oct 2016, 8:56 AM
Redstone Tehnik
Redstone Tehnik - avatar
+ 1
a=input("Enter a value: ") b=input("Enter a value: ") c=input("Enter a value: ") list1=[a, b, c] print("The list of numbers is:", list1) print("Lowest =", min(list1), "Highest =", max(list1) Are you looking for something like that?
4th Oct 2016, 7:25 AM
Katelyn
+ 1
print("enter the three numbers") num1 = input() num2 = input() num3 = input() minimum = min(num1, num2, num3) maximum = max(num1, num2, num3) print("maximum is " + maximum) print("minimum is " + minimum)
4th Oct 2016, 7:25 AM
Sriniketha
0
print'enter the the three numbers you want to read' l=[] x=input ('enter first number:') l.append (x) y=input('enter second number:') l append (y) z=input('enter third number:') l.append (z) print'maximum of the three values you entered is',max (l) print'minimum of the three values you entered is',min (l)
9th Oct 2016, 1:59 PM
Kirti Agarwal
0
Haha...itssofunny
14th Oct 2016, 4:03 PM
zhengjiawen