You have to write a python program which
- reads a .csv file
- stores the NEPTUN, MID and REP fields (midterm and repetition results).
- use csv.DictReader because the order of the columns may be different
- store those students who attended repetition at all
- If someone haven't attended a midterm, then the corresponding cell will be empty.
- For these students calculate the growth rate: the increase in performance divided by the original performance:
- if the original midterm was 0 points or haven't attended at all, then the relative growth rate is infinity: float("inf")
- unless the repetition was 0 points too, in that case the growth rate is 0
- The program should read the data from input.csv and write the output into output.csv in two columns: NEPTUN and GROWTH
- the rows should be sorted by NEPTUN code
For example if input.csv is this:
MID,REP,NAME,NEPTUN 0,,"people's front of judea",GM6MRT 17,,Steve Jobs,NC3J0K ,0,Brian,RQQCFE 19,9,Pontius Pilate,BQ6IAJ 1,,N. Jesus,QDMXVF 18,,Bill Gates,D1CXLO 0,,"knights who say NI",CZN5JA ,1,"Robin, the brave",BWQ5AU 17,19,"Gelehed, the pure",BY9B8G
The output.csv should contain this:
NEPTUN,GROWTH BQ6IAJ,-0.5263157894736842 BWQ5AU,inf BY9B8G,0.11764705882352941 RQQCFE,0
Deadline: 2018-05-25 23:59
The perfect solution is 5 points but you can have partial credit too.
Send a single python (.py) file from your math address to this address:
- The name of the file should be EN1_HF9_<user account>.py. For example for me: EN1_HF9_borbely.py