Exercises
9.1 (Class Average: Writing Grades to a Plain Text File) Figure 3.2 presented a class-average script in which you could enter any number of grades followed by a sentinel value, then calculate the class average. Another approach would be to read the grades from a file. In an IPython session, write code that enables you to store any number of grades into a
grades.txt
plain text file.9.2 (Class Average: Reading Grades from a Plain Text File) In an IPython session, write code that reads the grades from the
grades.txt
file you created in the previous exercise. Display the individual grades and their total, count and average.9.3 (Class Average: Writing Student Records to a CSV File) An instructor teaches a class in which each student ...
Get Intro to Python for Computer Science and Data Science: Learning to Program with AI, Big Data and The Cloud now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.