Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please complete this in python, Thanks! The name of the file is :cmpsc_catalog_small.csv Starter Code here must include this: def _loadCatalog(self, file): with open(file, r)
Please complete this in python, Thanks!
The name of the file is :"cmpsc_catalog_small.csv
Starter Code here must include this:
def _loadCatalog(self, file):
with open(file, "r") as f:
course_info = f.read()
# YOUR CODE STARTS HERE
Contents of the CSV file:
_loadCatalog(self, file) Reads a Comma Separated Values (CSV) file with course information and adds its Course obj ect to the courseOfferings dictionary. We are not using any libraries to read and process the csv file, instead, you will use string methods to clean the string for processing of the courses. The code for reading thefile has been provided in the starter code and you should not modify it. The information that needs to be processed is in the string course_info. Given the cmpsc_catalog_small.csv file with the following information (where you can assume the course name does not contain any commas): CMPSC 132, Programming and Computation II, 3 MATH 230, Calculus and Vector Analysis, 4 PHYS 213, General Physics, 2 CMPEN 270, Digital Design, 4 CMPSC 311, Introduction to Systems Programming, 3 CMPSC 360, Discrete Mathematics for Computer Science, 3 The code provided to open, read and close the file sets course_info works as follows: > file = "cmpsc_catalog_small.csv" with open(file, " r ") as f : .. course_info =fread() 'CMPSC 132, Programming and Computation II,3 MATH 230, Calculus and Vector Analysis, 4 PHYS 213, General Physics, 2 CMPEN270, Digital Design, 4 CMPSC 311, Introduction to Systems Programming, 3\ nCMPSC 360 , Discrete Mathematics for Computer Science, 3 ' All string methods are allowed in this method, however, split() is the most hel pful to process the string as needed. \begin{tabular}{c} \hline \\ \hline 1 \\ \hline 2 \\ \hline 3 \\ \hline 4 \\ \hline 5 \\ \hline 6 \\ \hline 7 \\ \hline 8 \\ \hline 9 \\ \hline 10 \\ \hline 11 \\ \hline 12 \\ \hline 13 \\ \hline 11 \end{tabular} A C D CMPSC 132 Programming and Computation II Calculus and Vector Analysis General Physics Digital Design Introduction to Systems Programming Discrete Mathematics for Computer ScienceStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started