 @lakshayarora7/

# ConventionalFatherlyEasternglasslizard ## No description

Files
• main.py
main.py
```1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
```
```# MEDIAN OF THREE VALUES

# A program to check whether the provided number is prime or not. The program should contain two functions; one for computing the median; the other a main program that reads 3 numbers and displays the median

# The median value is the middle of the three values when they are sorted into ascending order.

# Input: 3 numbers
# Output: median of the three numbers
# Also, ensure that your file when imported into another file doesn't trigger your program automatically

# THOUGHT PROCESS: Devise two functions: one for computing the median of three supplied numbers and returning the meidaam; second the main function to take three numbers as input, pass them to the median calculating function, and then display the returned median.

def medianOf(num1, num2, num3):
if num1 < num2 < num3 or num3 < num2 < num1:
return num2
if num1 < num3 < num2 or num2 < num3 < num1:
return num3
else:
return num1

def mainProgram():
number1 = int(input("Enter first number: "))
number2 = int(input("Enter second number: "))
number3 = int(input("Enter third number: "))

median = medianOf(number1, number2, number3)

print("Median of", str(number1), str(number2), str(number3), "is:", median)

# if the file has been run directly AND not been imported, call the main function
if __name__ == "__main__":
mainProgram()

# for repl.it
mainProgram()```