#Jonathan Hudson
#Student Number 12347890
#Date: 2020-08-26
#Lecture Practice
# Compute the median of a collection of values entered by the user
# Create an empty list to hold the values entered by the user
data = []
# Read the first input value
value = input("Enter a value (blank line to quit): ")
# while the value entered by the user is not a blank line
while value != "":
# append the value entered by the user to the end of the list
data.append(float(value))
# read the next input value from the user
value = input("Enter a value (blank line to quit): ")
# Sort the list
data.sort()
# If the length of the list is 0
if len(data) == 0:
# Report that there is no median
print("That list isn't long enough to have a median value.")
# elif the length of the list is odd
elif len(data) % 2 == 1:
# Report that the median is the middle value in the list
print("The median value of that list is", data[len(data) // 2])
# Otherwise
else:
# Report that the median is the average of the two middle values in the list
print("The median value of that list is", \
(data[len(data) // 2] + data[len(data) // 2 - 1]) / 2)