Informatics2-2018/HW9
A MathWikiből
(Változatok közti eltérés)
a (→Example) |
a (→Example) |
||
(egy szerkesztő 2 közbeeső változata nincs mutatva) | |||
17. sor: | 17. sor: | ||
== Hint == | == Hint == | ||
− | See this <tt>extract_points_from_cc.py</tt> in folder [http://sandbox.hlt.bme.hu/~gaebor/ea_anyag/Info2/ ea_anyag/Info2/]. | + | See the [http://sandbox.hlt.bme.hu/~gaebor/ea_anyag/Info2/e09_18i2_eng.html lecture notes] or this: <tt>extract_points_from_cc.py</tt> in folder [http://sandbox.hlt.bme.hu/~gaebor/ea_anyag/Info2/ ea_anyag/Info2/]. |
== Example == | == Example == | ||
23. sor: | 23. sor: | ||
For example if '''input.csv''' is this: | For example if '''input.csv''' is this: | ||
− | + | MID,REP,NAME,NEPTUN | |
0,,"people's front of judea",GM6MRT | 0,,"people's front of judea",GM6MRT | ||
17,,Steve Jobs,NC3J0K | 17,,Steve Jobs,NC3J0K | ||
36. sor: | 36. sor: | ||
The '''output.csv''' should contain this: | The '''output.csv''' should contain this: | ||
− | NEPTUN, | + | NEPTUN,GROWTH |
BQ6IAJ,-0.5263157894736842 | BQ6IAJ,-0.5263157894736842 | ||
BWQ5AU,inf | BWQ5AU,inf |
A lap jelenlegi, 2018. május 24., 10:13-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 the lecture notes or this: extract_points_from_cc.py in folder ea_anyag/Info2/.
Example
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
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