15. Write a python program to identify the median number among three randomly input numbers from user.
The output is:
Expected Sample Answer:
Please input the first number: 3
Please input the second number: 9
Please input the third number: 1
The median number of the above three numbers is 3
Sample Answer:
a = input("Please input the first number: ") b = input("Please input the second number: ") c = input("Please input the third number: ") print("The median number of the above three numbers is ") if b < a and a < c: print(a) elif c < a and a < b: print(a) elif c < b and b < a: print(b) elif a < b and b < c: print(b) elif b < c and c < a: print(c) elif a < c and c < b: print(c)
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)