-->
当前位置:首页 > 题库

PROGRAMMING:JMU Python exception basic edition of student performance processing

Luz5年前 (2021-05-10)题库407
Xiao Ming is helping the teacher to process the data. The first line of the data is n, which means there are n lines of integer scores to be counted.
If there is no error in the data, calculate the average value (keep 2 decimal places) and output.
If there is an error in the data, the processing will be stopped directly and the calculation will not be carried out.
**Note: * * the program can handle small errors appropriately. For example, if there are spaces on the left and right of some data, remove them first
The space is processed again.
###Input format:
The first line, N, represents the number of rows to be entered next.
Then enter the n-line score (integer).
###Output format:
If there is no exception in the input process, output 'all OK'. Otherwise, the error information in the format shown in examples 2 and 3 will be output.
If there is no exception, output: ` AVG grade = average '. Average (2 decimal places reserved)
No matter whether there are exceptions in the input process, the final output is ` process completed '`
###Input sample 1:
```in
three
one
two
three
```
###Output sample 1:
```out
All OK
avg grade = 2.00
Process Completed
```
###Input sample 2:
```in
three
a b
```
###Output sample 2:
```out
Error for data " a b"! Break
Process Completed
```
###Input sample 3:
```in
three
one
a
```
###Output sample 3:
```out
Error for data "a"! Break
Process Completed
```







answer:If there is no answer, please comment