Progress¶
The progress and final grade of a student must be calculated from the grades of 3 exams.
The progress is a string with the following possible values:
constantif all grades are equal.
positiveif every grade is greater or equal than the previous one (and is not constant).
negativeif every grade is less or equan than the previous one (and is not constant).
peakif the second grade is greater than the other two.
valleyif second grade is less than the other two.The average is calculated as the average of the two best partial grades (the worst is discarded) except if the progress is
negativewhere no grade will be discarded.
If any of the 3 given grades is not between 0.0 and 10.0 included, then will consider that an error happened. In this case, no matter what, the progress must be error and the average -1.0.
Please, implement the following Python function in the module progress (file progress.py) according to the following specification:
Exemples:
>>> progress(-1.0, 0.0, 5.0) ('error', -1.0) >>> progress(5.0, 7.5, 9.5) ('positive', 8.5) >>> progress(5.0, 5.0, 3.0) ('negative', 4.3)
Doctests are available at the progress-test.txt file.