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.
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
>>>