Informatics2-2018/HW9
A MathWikiből
(Változatok közti eltérés)
(Új oldal, tartalma: „= 9th Homework = == Program == You have to write a python program which * reads a <tt>.csv</tt> file * stores the '''NEPTUN''', '''MID''' and '''REP''' fields (midter…”) |
(→Program) |
||
14. sor: | 14. sor: | ||
** unless the repetition was 0 points too, in that case the growth rate is 0 | ** unless the repetition was 0 points too, in that case the growth rate is 0 | ||
* The program should read the data from <tt>input.csv</tt> and write the output into <tt>output.csv</tt> in two columns: NEPTUN and GROWTH | * The program should read the data from <tt>input.csv</tt> and write the output into <tt>output.csv</tt> in two columns: NEPTUN and GROWTH | ||
+ | ** the rows should be sorted by NEPTUN code | ||
== Hint == | == Hint == |
A lap 2018. május 21., 10:15-kori változata
Tartalomjegyzék |
9th Homework
Program
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:
- (REP-MID)/MID
- 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
Hint
See this extract_points_from_cc.py in folder ea_anyag/Info2/.
Example
For example if input.csv is this:
ZH,potZH,NEV,NEPTUN 0,,Júdea Népe Front,GM6MRT 17,,Munka István,NC3J0K ,0,Brian,RQQCFE 19,9,Poncius Pilátus,BQ6IAJ 1,,N. Jézus,QDMXVF 18,,Kapuk Vilmos,D1CXLO 0,,"Lovagok, aki azt mondják NI",CZN5JA ,1,"Robin, a bátor",BWQ5AU 17,19,"Gelehed, a szűzi",BY9B8G
The output.csv should contain this:
NEPTUN,JAVUL BQ6IAJ,-0.5263157894736842 BWQ5AU,inf BY9B8G,0.11764705882352941 RQQCFE,0
Handing-in
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:
- info1hazi.gmail.com
- The name of the file should be EN1_HF9_<user account>.py. For example for me: EN1_HF9_borbely.py