String = """3
99.5
asd
86.6"""
try:
s = []
for i in String.split("\n")[1:]:
a = float(i.strip())
s.append(a)
print(f"avg grade ={round(sum(s) / len(s), 2)}\nProcess Completed")
except ValueError:
for i in String.split("\n")[1:]:
if max(i) > "9":
a = i
break
print(f"could not convert string to float:'{a.strip()}'")
except ZeroDivisionError:
print("除数不能为0")