我正在尝试创建一个可以获取任意数量的输入并找到中位数的函数。我觉得我做错了,我无法获得这个功能。
我需要做什么?
- 我列了我的清单
- 我要求用户输入
- 我用 numpy 排序
- 我打印了中位数
代码:
import numpy
numbers = [1,2,3]
1 = input("Please type your first number")
2 = input("please type your second number")
3 = input("please type your third number")
median = numpy.median(numbers)
print(median)
我要完成的工作:
您想找到哪些数字的中位数?1,2,3,4,5,6,7
中位数为:4