Solution Review: Extracting all the Students With Marks
Explore how to extract student names and their marks from a text file by using Python's file handling, loops, and string manipulation methods. Learn to convert data types, aggregate marks, and conditionally select students based on total scores.
We'll cover the following...
We'll cover the following...
Solution
Explanation
The first thing we need to do is read the text file using the open command. Observe this in line 4 of the above code. Next, at line 5, we can use a for loop to traverse over the contents of the text file.
Note: ...