PROGRAMMING:JMU Python exception student performance processing professional edition
Xiao Ming is helping the teacher to count his grades. The teacher gives him a set of data. The first line of the data represents the number of students n, followed by
Each student's grade is represented by N lines of. The grade is an integer type. Xiao Ming wrote a program, which can be batch
Process the data and calculate the average score of all students. When there is no error in the data, it will prompt "all OK". When there is error in the data, it will prompt "all OK"
Some errors (a line is a floating-point number, a line is a non integer character), you can prompt which data error, and finally prompt
The first line error, the reason for the error, the total number of error lines. For other small errors, such as a line is an integer, but
Is around the redundant space, you can remove the space for normal statistics.
**In the final output:**
How many lines of data are processed, how many lines are correct, how many lines are wrong, and the average score (with two decimal places reserved).
**Advanced requirements:**
It is possible to enter n lines, but the following data is less than N lines. The situation needs to be dealt with. In this case.
Output 'end of files' and count the number of existing rows. See example 3
###Input format:
First behavior n
Next, input < = n rows of data to test
###Output format:
See sample output. When outputting the error reason, the whole line should be outputted (if there are left and right spaces in the line, the left and right spaces should also be outputted)
###Input sample 1:
```in
three
one
two
three
```
###Output sample 1:
```out
Total: 3
OK: 3
Error: 0
avg grade = 2.00
```
###Input sample 2:
```in
five
one
two
a
b 5
three
```
###Output sample 2:
```out
line 3 error for input " a "
line 4 error for input " b 5"
Total: 5
OK: 3
Error: 2
avg grade = 2.00
```
###Input sample 3:
```in
five
a
two
three
```
###Output sample 3:
```out
line 1 error for input " a"
end of files
Total: 3
OK: 2
Error: 1
avg grade = 2.50
```
**Tip: * for example 3, if you are testing in idle, you can enter the last line and press' Ctrl + D 'to end the input< br>
answer:If there is no answer, please comment
Each student's grade is represented by N lines of. The grade is an integer type. Xiao Ming wrote a program, which can be batch
Process the data and calculate the average score of all students. When there is no error in the data, it will prompt "all OK". When there is error in the data, it will prompt "all OK"
Some errors (a line is a floating-point number, a line is a non integer character), you can prompt which data error, and finally prompt
The first line error, the reason for the error, the total number of error lines. For other small errors, such as a line is an integer, but
Is around the redundant space, you can remove the space for normal statistics.
**In the final output:**
How many lines of data are processed, how many lines are correct, how many lines are wrong, and the average score (with two decimal places reserved).
**Advanced requirements:**
It is possible to enter n lines, but the following data is less than N lines. The situation needs to be dealt with. In this case.
Output 'end of files' and count the number of existing rows. See example 3
###Input format:
First behavior n
Next, input < = n rows of data to test
###Output format:
See sample output. When outputting the error reason, the whole line should be outputted (if there are left and right spaces in the line, the left and right spaces should also be outputted)
###Input sample 1:
```in
three
one
two
three
```
###Output sample 1:
```out
Total: 3
OK: 3
Error: 0
avg grade = 2.00
```
###Input sample 2:
```in
five
one
two
a
b 5
three
```
###Output sample 2:
```out
line 3 error for input " a "
line 4 error for input " b 5"
Total: 5
OK: 3
Error: 2
avg grade = 2.00
```
###Input sample 3:
```in
five
a
two
three
```
###Output sample 3:
```out
line 1 error for input " a"
end of files
Total: 3
OK: 2
Error: 1
avg grade = 2.50
```
**Tip: * for example 3, if you are testing in idle, you can enter the last line and press' Ctrl + D 'to end the input< br>
answer:If there is no answer, please comment