a=int(input())
b=input().split(' ')
k=0
all=0
for i in b:
try:
c=eval(i) #由此排除掉非实数字符串
except:
print(f"ERROR: {i} is not a legal number")
continue
if c<-1000 or c>1000:
print(f"ERROR: {i} is not a legal number")
continue
if '.' in i:
d=i.index('.')
if len(i[d+1::])>2: #由此排除小数位多余2位的浮点数
print(f"ERROR: {i} is not a legal number")
continue
all=all+c
k+=1
if k==0:
print(f"The average of {k} numbers is Undefined")
elif k==1:
print(f"The average of 1 number is {all/k:.2f}")
else:
print(f"The average of {k} numbers is {all/k:.2f}")
总体来说是一个比较简单的题目