Repository with assignments using the Test Informed Learning with Examples (TILE) method to integrate testing into existing programming courses for free.
Join our LinkedIN Community.
Use the following BibTeX entry to cite this work:
@INPROCEEDINGS{DVMB2023, author={Doorn, Niels and Vos, Tanja and Marín, Beatriz and Barendsen, Erik}, booktitle={2023 IEEE Conference on Software Testing, Verification and Validation (ICST)}, title={Set the right example when teaching programming: Test Informed Learning with Examples (TILE)}, year={2023}, volume={}, number={}, pages={269-280}, doi={10.1109/ICST57152.2023.00033} }
We have the following format for a text file:
23 2.5 3.0 1.1
34 2.0 1.0 1.0
17 1.0 1.0 1.1
450 4.0 2.1 2.2
55 4.0 4.0 2.0
In each line we have:
Write a function calculate_notes
in Python that receives as a parameter the name of a text file that has the format as thenotes.txt
, and writes on the screen the total number of students and how many of them have passed. A student will be deemed to have passed when the sum of his three grades is greater than or equal to 5.
>>> calculate_grades("threegrades.txt")
number of students: 5
number of students who have passed: 3
>>>