编程题:PY平均数
You are going to read a serial of none-negative integers, which ends with a negative number that does not count as one of the data. Your program calculates the average of all the none-negative integers, and prints the average which rounds to two decimal places.
There's always be at least one valid number in the sequence.
## 输入格式:
A serial of none-negative integers, ending with a negative number, which is not one of the valide data.
There's one number in one line only.
## 输出格式:
A number rounds to two decimal places, which is the average of the serial.
The format string for this case is:
f"{average:.2f}"
, given average is the variable of the average.
## 输入例子
in
1
2
3
4
5
6
-1
## 输出例子
out
3.50
答案:若无答案欢迎评论
There's always be at least one valid number in the sequence.
## 输入格式:
A serial of none-negative integers, ending with a negative number, which is not one of the valide data.
There's one number in one line only.
## 输出格式:
A number rounds to two decimal places, which is the average of the serial.
The format string for this case is:
f"{average:.2f}"
, given average is the variable of the average.
## 输入例子
in
1
2
3
4
5
6
-1
## 输出例子
out
3.50
答案:若无答案欢迎评论