26 lines
673 B
Python
26 lines
673 B
Python
from array import array
|
|
import numbers
|
|
import statistics
|
|
array=[]
|
|
|
|
def add_items_to_array():
|
|
print("Operations:\n1.Add numbers\n2.That are all numbers\n3.Exit\nThere are %s Elements in the array" %(len(array)))
|
|
operation=int(input("Operation:"))
|
|
if operation == 1:
|
|
numbers_to_add=float(input("Number:"))
|
|
array.append(numbers_to_add)
|
|
add_items_to_array()
|
|
elif operation == 2:
|
|
get_median()
|
|
elif operation == 3:
|
|
exit()
|
|
else:
|
|
print("Input the right operation")
|
|
add_items_to_array()
|
|
|
|
def get_median():
|
|
median_item=statistics.median(array)
|
|
print(median_item)
|
|
exit()
|
|
|
|
add_items_to_array() |