# Week 8 at Blockfuse Labs: Exploring Dictionaries and Tuples in Python
**Instructor**: Mr. Bankak
**Week**: 8
**Course**: Python Programming
**Author**: Methuselah Mark
---
## ✨ Overview
This week at **Blockfuse Labs**, under the guidance of Mr. Bankak, we dove into two powerful data structures in Python: **Dictionaries** and **Tuples**. These structures help in storing and organizing data efficiently. Below is a summary of the key concepts we learned, along with practical examples and use cases.
---
## 🧱 Python Dictionaries
### 🔑 What is a Dictionary?
A **dictionary** in Python is an unordered collection of key-value pairs. Each key must be unique and immutable (like strings or numbers), while the value can be of any data type.
```python
# Example:
student = {
"name": "Mark",
"age": 20,
"score": 85
}
```
📘 Key Concepts:
Accessing values: Use the key to get a value.
```python
print(student["name"]) # Output: Mark
```
.keys(): returns all keys
.values(): returns all values
.items(): returns all key-value pairs
Use Case:
Dictionaries are perfect for storing data where each item has a unique label, like student records.
Python Tuples
What is a Tuple?
A tuple is a collection of values that is ordered and immutable, meaning once created, it cannot be changed.
```python
# Example:
coordinates = (6.45, 9.23)
```
Tuples are immutable: You can't add, remove, or change values after creation.
Can contain different data types:
```python
person = ("Mark", 20, True)
```
Use Case:
Tuples are ideal when you want to protect data from being changed, such as storing GPS coordinates or multiple return values from a function.
Mini project example
```python
# A dictionary with tuples as values
students = {
"Alice": ("Physics", 85),
"Bob": ("Chemistry", 78),
"Charlie": ("Math", 92)
}
print(students)
```
This week helped solidify my understanding of how to manage structured data in Python. Mr. Bankak broke down the concepts with clarity, real-life examples, and hands-on exercises. I now feel more confident using both dictionaries and tuples in real projects.