In: Computer Science
This phyton program takes in three integer parameters and displays them in ascending order. You can assume that the numbers entered are integers. You CAN'T use lists, min(), max(), or the sort utility. The point is to use if tests. sortThreeIntegers( 39, 2, 5 ) should display: The numbers in order are: 2 5 39 sortThreeIntegers( 14, -12, -1000 ) should display: The numbers in order are: -1000 -12 14
def sortThreeIntegers( x, y, z ): < your code goes here >
def sortThreeIntegers(a,b,c): print("The numbers in order are: ",end="") if (a <= b and a <= c): print(a, end=" ") if (b <= c): print(b, end=" ") print(c, end="") else: print(c, end=" ") print(b, end="") elif (b <= a and b <= c): print(b, end=" ") if (a <= c): print(a, end=" ") print(c, end="") else: print(c, end=" ") print(a, end="") else: print(c, end=" ") if (a <= b): print(a, end=" ") print(b, end="") else: print(b, end=" ") print(a, end="") print() # Testing sortThreeIntegers(39,2,5) sortThreeIntegers(14,-12,-1000)