A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Write a Python program to find the median of three values
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)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now