Q:

Write a Python program to find the median of three values

0

Write a Python program to find the median of three values

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

I have used python 3.7 compiler for debugging purpose.

num1 = float(input("Input first number: "))
num2 = float(input("Input second number: "))
num3 = float(input("Input third number: "))
if num1 > num2:
    if num1 < num3:
        median = num1
    elif b > num3:
        median = num2
    else:
        median = num3
else:
    if num1 > num3:
        median = num1
    elif num2 < num3:
        median = num2
    else:
        median = num3
 
print("The median is", median)

Result:

Input first number: 25

Input second number: 75

Input third number: 95

The median is 75.0

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

<< Write a Python program to calculate the sum and av...