Activity 18: Master Python Dictionaries Data Structure
In this activity, you will practice using dictionaries to store and manage multiple instances of objects like Product, Employee, Books, University, and Restaurant. You will create dictionaries for these objects and populate them with details (e.g., names, prices, job titles). This activity is designed to help you understand how to manage collections of data in a structured manner.
Create the following Python classes:
1. Products
• Dictionary Structure:
A dictionary is a data structure that stores key-value pairs. In this case, the dictionary products
stores product names as keys and their details (name and price) as values.
2. Employee
• Dictionary Structure:
A dictionary is a data structure that stores key-value pairs. In this case, the dictionary employees
stores employee names as keys and their details (name and job title) as values.
3. Books
• Dictionary Structure:
A dictionary is a data structure that stores key-value pairs. In this case, the dictionary books
stores book names as keys and their details (title and author) as values.
4. Universities
• Dictionary Structure:
A dictionary is a data structure that stores key-value pairs. In this case, the dictionary universities
stores university names as keys and their details (name and location) as values.
5. Restaurant
• Dictionary Structure:
This dictionary, named restaurants
, acts as a container for individual restaurant dictionaries. Each key in this outer dictionary (e.g., restaurant1
, restaurant2
) represents a unique restaurant.
Each value associated with a key in the outer dictionary is itself a dictionary. This inner dictionary holds the specific details of a particular restaurant, such as its name and cuisine type.
In summary, this code effectively utilizes dictionaries to manage and display information about a collection of books, demonstrating a practical application of dictionaries in Python.
Github Repository Link: https://github.com/jnss19/MasterPythonDictionaries.git