Skip to content

Commit 15bbf43

Browse files
authored
Update README.md
1 parent 372974d commit 15bbf43

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

day_08_Lists/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
# Day 8: Data Structures - Mastering Lists 📋
23

34
Welcome to Day 8 and the start of Week 2! We're leveling up from single variables to our first **data structure**: the **List**. A list is a powerful and versatile tool for storing collections of data, and you will use it constantly in your Python programs.
@@ -77,3 +78,36 @@ print("Fruits list after removing 'apple':", fruits)
7778
# d) Add an item at a specific index
7879
fruits.insert(1, "grape")
7980
print("Fruits list after inserting 'grape' at index 1:", fruits)
81+
````
82+
83+
### 📝 Practice Exercises
84+
85+
1. **Shopping List:** Create a list of your favorite foods. Print the first and last items.
86+
2. **Add & Remove:** Create an empty list called `my_tasks`. Use `.append()` to add three tasks. Then, use `.remove()` to remove one of them. Print the list after each step.
87+
3. **Guest List:** Start with a list of three guests for a party. Use `print()` to announce that one guest can't make it. Then, use `.remove()` and `.append()` to replace them with a new guest. Print the final guest list.
88+
4. **Count Items:** Create a list with some duplicate numbers or words. Use `len()` to print how many items are in the list.
89+
90+
### ✨ Best Practices & Professional Notes
91+
92+
* **Zero-Indexing is Standard:** The concept of starting at `0` is fundamental in programming, not just for lists but also for strings and other data structures. It's a key habit to build.
93+
* **Mutability:** Be aware that because lists are mutable, if you assign `list_b = list_a`, both variables actually point to the same list in memory. Changing `list_b` will also change `list_a`. If you want a separate copy, use `list_b = list_a.copy()`.
94+
* **Heterogeneous Data:** While lists can hold different data types, it's often a best practice to keep a list's contents homogeneous (all numbers, all strings, etc.) for clarity and easier processing.
95+
* **Looping (Coming Soon\!):** The real power of lists is when you combine them with loops (`for` and `while`) to process every item in the list automatically. We'll cover this tomorrow\!
96+
97+
### 🏃 How to Run This Code
98+
99+
1. Open your terminal or command prompt.
100+
2. Navigate to the `Day_08_Lists` directory.
101+
```bash
102+
cd path/to/your/fluffy-python/Day_08_Lists
103+
```
104+
3. Run the script using:
105+
```bash
106+
python data_structures_lists.py
107+
# Or if you installed python3:
108+
# python3 data_structures_lists.py
109+
```
110+
111+
### ➡️ What's Next?
112+
113+
Tomorrow, we'll learn about **Loops** – how to automatically repeat actions on every item in our lists\!

0 commit comments

Comments
 (0)