Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Specification This script reads in class data from a file and creates a dictionary. It then prints the data from the dictionary. The script has
Specification This script reads in class data from a file and creates a dictionary. It then prints the data from the dictionary. The script has the following functions class_tuple_create print_classes class_tuple_create This function has the following header def class_tuple_create( filename) : The function reads in a file with four fields of data about a class. The fields are Course ID Room number Instructor Start time The function must print an error message if the file cannot be opened for any reason. The function should read in each line of the file and split it into a list of 4 elements. It should add the information in the line into a dictionary, where the key is the course number and the value is a tuple consisting of the room number, the instructor and the start time. The function should return this dictionary when it has read all the lines in the file. print_classes This function has the following header def print_classes (class_info): It should print the following table header ID Room Instr Start Then it should print out the data for each class in alphabetical order by Class ID. Test Code The script must contain the following test code at the bottom of the file
Step 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