如果不使用Python中的这个函数,我如何找到三个数字的中位数还有另一种方法median_1 = stats.median(alpha_1)
enter code here
def median(alpha_1):
#median_1 = sorted(alpha)
median_1 = statistics.median(alpha_1)
return median_1
if __name__ == "__main__":
# FIXME 1: Print the statement where you say what the program is going to do
num_1 = int(input("Input first number:\n"))
num_2 = int(input("Input second number:\n"))
num_3 = int(input("Input third number:\n"))
# FIXME 2: Propmt the user to input 3 numbers
c = num_1, num_2, num_3
f = median(c)
print("The median is",f)
慕尼黑5688855
相关分类