Deadline: October 11, 2024
Activity Type: Coding
Goal: Understand and apply the list data structure for various data sets.
Overview:
In this activity, you will practice using lists to store and manage multiple instances of objects like Product, Employee, Books, University, and Restaurant. You will create lists 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.
This is a follow-up to Activity : Data Structure Again
Check this:
Instructions:
-
Create the following Python classes:
-
Product: Store product details (e.g., product name, price).
-
Employee: Store employee details (e.g., name, job title).
-
Books: Store book details (e.g., title, author).
-
University: Store university details (e.g., name, location).
-
Restaurant: Store restaurant details (e.g., name, cuisine type).
-
-
Use Lists to store the details of each class:
-
Create lists for each object (e.g., list of product names, list of prices, list of employee job titles, etc.).
-
Populate the lists with at least 5 entries per object.
-
-
Access and print the details from the lists.
Example Using Lists:
Below is an example of how you can structure your data using lists for students, similar to the data you provided in the image:
Example: Student Data Using Lists
Student.py:
# Lists storing student data
student_name_list = ["Juan Carlos", "Jose Rizal", "Juan Luna", "Andres Bonifacio", "Justin Bieber", "Michael Jordan", "Andrew Jordan", "Jessa Boe", "Ted Talk"]
student_section_list = ["BSIT-4B", "BSIT-2A", "BSIT-3A", "BSIT-3A", "BSIT-2A", "BSIT-4A", "BSIT-4A", "BSIT-2B", "BSIT-3B"]
student_id_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]
student_email_list = ["juan@gmail.com", "jose@gmail.com", "juanl@gmail.com", "andres@gmail.com", "justin@gmail.com", "michael@gmail.com", "andrew@gmail.com", "jessa@gmail.com", "ted@gmail.com"]
# Print student data
print("Student Data:")
for i in range(len(student_name_list)):
print(f"ID: {student_id_list[i]}, Name: {student_name_list[i]}, Section: {student_section_list[i]}, Email: {student_email_list[i]}")
Tasks:
-
Define lists for storing data related to the classes: Product, Employee, Books, University, and Restaurant.
-
Populate the lists with data for each class, ensuring there are at least 5 entries.
-
Access and print the details of each object from the list.
Submission:
-
Document your results on Hashnode.com or Medium.com.
-
Include your code snippets and output for each class.
-
Explain what you learned about using lists to store and access data.
-
I need to see more than 5 commits. use a best git naming convention
-
Standard naming convention for commit messages (thirdygayares.com)
-
name your GitHub repository MasterPythonList