Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A 'dictionary' is a data structure that stores each element in a list as a pair, key:value. for instance, you could have a dictionary of
A 'dictionary' is a data structure that stores each element in a list as a pair, key:value. for instance, you could have a dictionary of pairs consisting of a persons name and their favorite numbers. my_dictionary = {"Bob":[3, 45, 6], "Tina":[32, 5, 9], "Carl":[6, 77, 12]} You will write code that works with 3 dictionaries simultaneously. First is a dictionary of instructors (called instructors) and the classes they teach. Second is a dictionary consisting of students (called students) and classes they are taking. Third is a dictionary called teaches that consists of only a single entry ["instructor":"student"] Your task is to write a function called classDirectory that takes three inputs: the dictionaries instructors, students, and teaches. The return should be a boolean. TRUE if teaches is true, else FALSE. In other words if there is a teacher named Smith and a student named Jones and Smith teaches Jones, then [Smith:Jones] should return TRUE. Logical Constraints: o An instructor can teach only 1 class. Students can enroll in multiple classes. o teaches will contain a single entry of instructor and student
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