# Activity 20: Data Structure Again

## 1\. **List**

A **List** is an ordered collection of elements. Lists are typically used to store multiple items of the same type, such as numbers, strings, or even objects. Each element in the list has an index, which is its position in the list, starting from 0.

### Characteristics of a List:

* **Ordered**: The items in a list have a specific order.
    
* **Indexed**: Each item can be accessed by its index.
    
* **Mutable**: Lists can be modified after they are created (e.g., adding or removing elements).
    
* **Homogeneous**: In some programming languages, the elements are expected to be of the same type, but in others, they can be of mixed types..
    

## 2\. **Object**

An **Object** is a data structure that stores data in the form of key-value pairs. In an object, each key is unique, and each key maps to a value, which can be any type of data (string, number, list, another object, etc.).

### Characteristics of an Object:

* **Unordered**: The key-value pairs are not stored in any particular order.
    
* **Key-Value Pair**: Each item is stored as a pair, with a key (identifier) and a corresponding value.
    
* **Mutable**: You can modify the values associated with keys or add new key-value pairs.
    
* **Heterogeneous**: The values associated with different keys can be of different types.
    

## 3\. **List of Objects**

A **List of Objects** is exactly what it sounds like—a list that contains multiple objects. This structure allows you to store collections of data where each item in the list is an object. It's useful when you want to organize complex data into smaller, manageable pieces.

### Characteristics of a List of Objects:

* **Ordered**: The list itself maintains an order, so you can access each object by its index.
    
* **Objects as Items**: Each item in the list is an object, which can hold multiple properties (key-value pairs).
    
* **Mutable**: Both the list and the objects within it can be modified.
    
* **Heterogeneous Objects**: The objects can be different from one another, containing different sets of keys and values.
    

## Key Differences Between List, Object, and List of Objects

### 1\. **Data Structure Type**

* A **List** is an ordered collection of items.
    
* An **Object** is a collection of key-value pairs.
    
* A **List of Objects** is a list where each item is an object.
    

### 2\. **Accessing Data**

* In a **List**, you access elements by their index.
    
* In an **Object**, you access data using keys.
    
* In a **List of Objects**, you first access an object by its index in the list and then use keys to access data within the object.
    

### 3\. **Use Cases**

* **List**: Useful for ordered collections of similar items, like a list of numbers or strings.
    
* **Object**: Ideal for representing data where each element has a specific identifier (key), such as user profiles or settings.
    
* **List of Objects**: Perfect for situations where you need to represent a collection of complex data, like a list of users, each with a set of attributes.
    

### Product table

**List**

```python
product_list = ["Laptop", "Desk Chair", "Smartwatch", "Notebook", "Running Shoes"]
product_categories = ["Electronics", "Furniture", "Electronics", "Stationery", "Apparel"]
product_prices = [750, 100, 200, 55, 80]
product_stocks = [50, 200, 150, 0, 100]
product_supplier_emails = ["supplier1@gmail.com", "supplier2@gmail.com", "supplier3@gmail.com", "supplier4@gmail.com", "supplier5@gmail.com"]
```

**Object**

```python
product_object1 = {
    "ID": 1,
    "Name": "Laptop",
    "Category": "Electronics",
    "Price": 750,
    "Stock": 50,
    "Supplier Email": "supplier1@gmail.com"
}

product_object2 = {
    "ID": 2,
    "Name": "Desk Chair",
    "Category": "Furniture",
    "Price": 100,
    "Stock": 200,
    "Supplier Email": "supplier2@gmail.com"
}

product_object3 = {
    "ID": 3,
    "Name": "Smartwatch",
    "Category": "Electronics",
    "Price": 200,
    "Stock": 150,
    "Supplier Email": "supplier3@gmail.com"
}

product_object4 = {
    "ID": 4,
    "Name": "Notebook",
    "Category": "Stationery",
    "Price": 55,
    "Stock": 0,
    "Supplier Email": "supplier4@gmail.com"
}

product_object5 = {
    "ID": 5,
    "Name": "Running Shoes",
    "Category": "Apparel",
    "Price": 80,
    "Stock": 100,
    "Supplier Email": "supplier5@gmail.com"
}
```

**List of object**

```python
products = [
  {
    "ID": 1,
    "Name": "Laptop",
    "Category": "Electronics",
    "Price": 750,
    "Stock": 50,
    "Supplier Email": "supplier1@gmail.com"
  },
  {
    "ID": 2,
    "Name": "Desk Chair",
    "Category": "Furniture",
    "Price": 100,
    "Stock": 200,
    "Supplier Email": "supplier2@gmail.com"
  },
  {
    "ID": 3,
    "Name": "Smartwatch",
    "Category": "Electronics",
    "Price": 200,
    "Stock": 150,
    "Supplier Email": "supplier3@gmail.com"
  },
  {
    "ID": 4,
    "Name": "Notebook",
    "Category": "Stationery",
    "Price": 5,
    "Stock": 500,
    "Supplier Email": "supplier4@gmail.com"
  },
  {
    "ID": 5,
    "Name": "Running Shoes",
    "Category": "Apparel",
    "Price": 80,
    "Stock": 100,
    "Supplier Email": "supplier5@gmail.com"
  }
]
```

### Employee table

**List**

```python
employee_ids = [1, 2, 3, 4, 5]
employee_names = ["John Doe", "Jane Smith", "Mark Johnson", "Lisa Wong", "Paul McDonald"]
employee_departments = ["Sales", "Human Resources", "IT", "Marketing", "Finance"]
employee_ages = [30, 25, 40, 28, 35]
employee_emails = ["john.doe@company.com", "jane.smith@company.com", "mark.johnson@company.com", "lisa.wong@company.com", "paul.mcdonald@company.com"]
```

**Object**

```python
employee_object1 = {
    "ID": 1,
    "Name": "John Doe",
    "Department": "Sales",
    "Age": 30,
    "Email": "john.doe@company.com"
}

employee_object2 = {
    "ID": 2,
    "Name": "Jane Smith",
    "Department": "Human Resources",
    "Age": 25,
    "Email": "jane.smith@company.com"
}

employee_object3 = {
    "ID": 3,
    "Name": "Mark Johnson",
    "Department": "IT",
    "Age": 40,
    "Email": "mark.johnson@company.com"
}

employee_object4 = {
    "ID": 4,
    "Name": "Lisa Wong",
    "Department": "Marketing",
    "Age": 28,
    "Email": "lisa.wong@company.com"
}

employee_object5 = {
    "ID": 5,
    "Name": "Paul McDonald",
    "Department": "Finance",
    "Age": 35,
    "Email": "paul.mcdonald@company.com"
}
```

**List of object**

```python
employees = [
    {
        "ID": 1,
        "Name": "John Doe",
        "Department": "Sales",
        "Age": 30,
        "Email": "john.doe@company.com"
    },
    {
        "ID": 2,
        "Name": "Jane Smith",
        "Department": "Human Resources",
        "Age": 25,
        "Email": "jane.smith@company.com"
    },
    {
        "ID": 3,
        "Name": "Mark Johnson",
        "Department": "IT",
        "Age": 40,
        "Email": "mark.johnson@company.com"
    },
    {
        "ID": 4,
        "Name": "Lisa Wong",
        "Department": "Marketing",
        "Age": 28,
        "Email": "lisa.wong@company.com"
    },
    {
        "ID": 5,
        "Name": "Paul McDonald",
        "Department": "Finance",
        "Age": 35,
        "Email": "paul.mcdonald@company.com"
    }
]
```

### Books table

**List**

```python
book_ids = [1, 2, 3, 4, 5]
book_titles = ["The Great Gatsby", "To Kill a Mockingbird", "1984", "The Catcher in the Rye", "A Brief History of Time"]
book_authors = ["F. Scott Fitzgerald", "Harper Lee", "George Orwell", "J.D. Salinger", "Stephen Hawking"]
book_genres = ["Fiction", "Fiction", "Dystopian", "Fiction", "Non-fiction"]
book_published_years = [1925, 1960, 1949, 1951, 1988]
book_isbns = ["978-0743273565", "978-0060935467", "978-0451524935", "978-0316769488", "978-0553380163"]
book_stocks = [20, 35, 40, 25, 10]
book_prices = [15.99, 10.99, 9.99, 8.99, 18.99]
```

**Object**

```python
book_object1 = {
    "ID": 1,
    "Title": "The Great Gatsby",
    "Author": "F. Scott Fitzgerald",
    "Genre": "Fiction",
    "Published Year": 1925,
    "ISBN": "978-0743273565",
    "Stock": 20,
    "Price": 15.99
}

book_object2 = {
    "ID": 2,
    "Title": "To Kill a Mockingbird",
    "Author": "Harper Lee",
    "Genre": "Fiction",
    "Published Year": 1960,
    "ISBN": "978-0060935467",
    "Stock": 35,
    "Price": 10.99
}

book_object3 = {
    "ID": 3,
    "Title": "1984",
    "Author": "George Orwell",
    "Genre": "Dystopian",
    "Published Year": 1949,
    "ISBN": "978-0451524935",
    "Stock": 40,
    "Price": 9.99
}

book_object4 = {
    "ID": 4,
    "Title": "The Catcher in the Rye",
    "Author": "J.D. Salinger",
    "Genre": "Fiction",
    "Published Year": 1951,
    "ISBN": "978-0316769488",
    "Stock": 25,
    "Price": 8.99
}

book_object5 = {
    "ID": 5,
    "Title": "A Brief History of Time",
    "Author": "Stephen Hawking",
    "Genre": "Non-fiction",
    "Published Year": 1988,
    "ISBN": "978-0553380163",
    "Stock": 10,
    "Price": 18.99
}
```

**List of object**

```python
books = [
    {
        "ID": 1,
        "Title": "The Great Gatsby",
        "Author": "F. Scott Fitzgerald",
        "Genre": "Fiction",
        "Published Year": 1925,
        "ISBN": "978-0743273565",
        "Stock": 20,
        "Price": 15.99
    },
    {
        "ID": 2,
        "Title": "To Kill a Mockingbird",
        "Author": "Harper Lee",
        "Genre": "Fiction",
        "Published Year": 1960,
        "ISBN": "978-0060935467",
        "Stock": 35,
        "Price": 10.99
    },
    {
        "ID": 3,
        "Title": "1984",
        "Author": "George Orwell",
        "Genre": "Dystopian",
        "Published Year": 1949,
        "ISBN": "978-0451524935",
        "Stock": 40,
        "Price": 9.99
    },
    {
        "ID": 4,
        "Title": "The Catcher in the Rye",
        "Author": "J.D. Salinger",
        "Genre": "Fiction",
        "Published Year": 1951,
        "ISBN": "978-0316769488",
        "Stock": 25,
        "Price": 8.99
    },
    {
        "ID": 5,
        "Title": "A Brief History of Time",
        "Author": "Stephen Hawking",
        "Genre": "Non-fiction",
        "Published Year": 1988,
        "ISBN": "978-0553380163",
        "Stock": 10,
        "Price": 18.99
    }
]
```

### University table

**List**

```python
university_ids = [1, 2, 3, 4, 5]
university_names = ["University of the Philippines", "Ateneo de Manila University", "De La Salle University", "University of Santo Tomas", "Polytechnic University of the Philippines"]
university_locations = ["Quezon City", "Quezon City", "Manila", "Manila", "Manila"]
university_established_years = [1908, 1859, 1911, 1611, 1904]
university_types = ["Public", "Private", "Private", "Private", "Public"]
university_websites = ["www.up.edu.ph", "www.ateneo.edu", "www.dlsu.edu.ph", "www.ust.edu.ph", "www.pup.edu.ph"]
```

**Object**

```python
university_object1 = {
    "ID": 1,
    "Name": "University of the Philippines",
    "Location": "Quezon City",
    "Established Year": 1908,
    "Type": "Public",
    "Website": "www.up.edu.ph"
}

university_object2 = {
    "ID": 2,
    "Name": "Ateneo de Manila University",
    "Location": "Quezon City",
    "Established Year": 1859,
    "Type": "Private",
    "Website": "www.ateneo.edu"
}

university_object3 = {
    "ID": 3,
    "Name": "De La Salle University",
    "Location": "Manila",
    "Established Year": 1911,
    "Type": "Private",
    "Website": "www.dlsu.edu.ph"
}

university_object4 = {
    "ID": 4,
    "Name": "University of Santo Tomas",
    "Location": "Manila",
    "Established Year": 1611,
    "Type": "Private",
    "Website": "www.ust.edu.ph"
}

university_object5 = {
    "ID": 5,
    "Name": "Polytechnic University of the Philippines",
    "Location": "Manila",
    "Established Year": 1904,
    "Type": "Public",
    "Website": "www.pup.edu.ph"
}
```

**List of object**

```python
universities = [
    {
        "ID": 1,
        "Name": "University of the Philippines",
        "Location": "Quezon City",
        "Established Year": 1908,
        "Type": "Public",
        "Website": "www.up.edu.ph"
    },
    {
        "ID": 2,
        "Name": "Ateneo de Manila University",
        "Location": "Quezon City",
        "Established Year": 1859,
        "Type": "Private",
        "Website": "www.ateneo.edu"
    },
    {
        "ID": 3,
        "Name": "De La Salle University",
        "Location": "Manila",
        "Established Year": 1911,
        "Type": "Private",
        "Website": "www.dlsu.edu.ph"
    },
    {
        "ID": 4,
        "Name": "University of Santo Tomas",
        "Location": "Manila",
        "Established Year": 1611,
        "Type": "Private",
        "Website": "www.ust.edu.ph"
    },
    {
        "ID": 5,
        "Name": "Polytechnic University of the Philippines",
        "Location": "Manila",
        "Established Year": 1904,
        "Type": "Public",
        "Website": "www.pup.edu.ph"
    }
]
```

### Restaurant table

**List**

```python
restaurant_ids = [1, 2, 3, 4, 5]
restaurant_names = ["Vikings Luxury Buffet", "Antonio's Restaurant", "Mesa Filipino Moderne", "Manam Comfort Filipino", "Ramen Nagi"]
restaurant_locations = ["Pasay City", "Tagaytay", "Makati City", "Quezon City", "Various Locations"]
restaurant_cuisine_types = ["Buffet", "Fine Dining", "Filipino", "Filipino", "Japanese"]
restaurant_established_years = [2011, 2002, 2009, 2013, 2013]
restaurant_websites_or_contacts = ["www.vikings.ph", "www.antoniosrestaurant.ph", "www.mesa.ph", "www.manam.ph", "www.ramennagi.com.ph"]
```

**Object**

```python
restaurant_object1 = {
    "ID": 1,
    "Name": "Vikings Luxury Buffet",
    "Location": "Pasay City",
    "Cuisine Type": "Buffet",
    "Established Year": 2011,
    "Website or Contact": "www.vikings.ph"
}

restaurant_object2 = {
    "ID": 2,
    "Name": "Antonio's Restaurant",
    "Location": "Tagaytay",
    "Cuisine Type": "Fine Dining",
    "Established Year": 2002,
    "Website or Contact": "www.antoniosrestaurant.ph"
}

restaurant_object3 = {
    "ID": 3,
    "Name": "Mesa Filipino Moderne",
    "Location": "Makati City",
    "Cuisine Type": "Filipino",
    "Established Year": 2009,
    "Website or Contact": "www.mesa.ph"
}

restaurant_object4 = {
    "ID": 4,
    "Name": "Manam Comfort Filipino",
    "Location": "Quezon City",
    "Cuisine Type": "Filipino",
    "Established Year": 2013,
    "Website or Contact": "www.manam.ph"
}

restaurant_object5 = {
    "ID": 5,
    "Name": "Ramen Nagi",
    "Location": "Various Locations",
    "Cuisine Type": "Japanese",
    "Established Year": 2013,
    "Website or Contact": "www.ramennagi.com.ph"
}
```

**List of object**

```python
restaurants = [
    {
        "ID": 1,
        "Name": "Vikings Luxury Buffet",
        "Location": "Pasay City",
        "Cuisine Type": "Buffet",
        "Established Year": 2011,
        "Website or Contact": "www.vikings.ph"
    },
    {
        "ID": 2,
        "Name": "Antonio's Restaurant",
        "Location": "Tagaytay",
        "Cuisine Type": "Fine Dining",
        "Established Year": 2002,
        "Website or Contact": "www.antoniosrestaurant.ph"
    },
    {
        "ID": 3,
        "Name": "Mesa Filipino Moderne",
        "Location": "Makati City",
        "Cuisine Type": "Filipino",
        "Established Year": 2009,
        "Website or Contact": "www.mesa.ph"
    },
    {
        "ID": 4,
        "Name": "Manam Comfort Filipino",
        "Location": "Quezon City",
        "Cuisine Type": "Filipino",
        "Established Year": 2013,
        "Website or Contact": "www.manam.ph"
    },
    {
        "ID": 5,
        "Name": "Ramen Nagi",
        "Location": "Various Locations",
        "Cuisine Type": "Japanese",
        "Established Year": 2013,
        "Website or Contact": "www.ramennagi.com.ph"
    }
]
```
