Question: Write a Python function school_courses which consumes data, a nonempty string containing the name of the file containing information about this term's students and the

 Write a Python function school_courses which consumes data, a nonempty string

Write a Python function school_courses which consumes data, a nonempty string containing the name of the file containing information about this term's students and the courses they are enrolled in. The function returns a new dictionary: The keys correspond to the names of the courses (all in upper case). You may assume that courses' names do not include space The corresponding value for a course is a list of all students who are enrolled in this course This list must be sorted into alphabetical order for the names of the students, based on Python's sort method The input file will have the name of a student in a line, followed by a list of courses the student is enrolled in, then a blank line, and then information about another student. For example, the provided file s18.txt follows this format. You may assume the following: .There will be information about at least one student in the consumed file. .There will be at least one course listed for each student. Two course names are the same regardless of upper and lower case differences, for example CS116, Cs116, cS116, cs116, all are considered to be the same course Calling school_courses ("s18.txt") returns {"CS115': ['Alice Dean', 'Dave Brown ', 'Mary Sue '], 'MATH 135': ['Alice Dean', Dave Brown', 'CHEM100': ['Alice Dean', 'Dave Brown', 'Mary Sue','MATH200' ['Alice Dean', 'Mary Sue')

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!