我正在嘗試製作一個程序,您可以選擇說中位數的選項,接下來我可以讓它請求您放入列表並說(「例如:10,40,30」),然後讓它把每個項目放在「,」之前,並將它附加到一個列表中,然後使其取出「,」。任何想法我可以做到這一點?列表中的Python Medians
這就是我的一切,到目前爲止
option5=(["1. Median", "2. Average", "3. Mean", "4. Mode"])
for items in option5:
print (items)
print ("")
choice5=input("Choose another option: ")
while choice5 not in ("1234"):
choice5=input("Choose another option: ")
print("")
if choice5 == "1":
print("Please put your list of numbers like the example below.")
print("Ex: 10,20,30")
print("")
median=input("List: ")
有一個看看'Counter' [收藏](http://docs.python.org/2/library/collections.html#collections.Counter) – danodonovan