🚀 Day 9 of My Python Learning Journey

Understanding the Differences Between List, Tuple, Set, and Dictionary

After completing Python’s core data structures, I decided to summarize the main differences between them. These are the building blocks of Python, and knowing when to use each make…


This content originally appeared on DEV Community and was authored by Aditi Sharma

Understanding the Differences Between List, Tuple, Set, and Dictionary

After completing Python’s core data structures, I decided to summarize the main differences between them. These are the building blocks of Python, and knowing when to use each makes a big difference in writing clean & efficient code.

🔹 1. List
• Ordered
• Mutable (can change after creation)
• Allows duplicates
• Best for collections that need modification

my_list = [1, 2, 2, 3]
my_list.append(4)
print(my_list) # [1, 2, 2, 3, 4]

🔹 2. Tuple
• Ordered
• Immutable (cannot be changed after creation)
• Allows duplicates
• Best for fixed collections (e.g., coordinates, settings)

my_tuple = (1, 2, 3)
print(my_tuple[0]) # 1

🔹 3. Set
• Unordered
• Mutable (can add/remove items)
• No duplicates
• Best for uniqueness, filtering, and set operations

my_set = {1, 2, 2, 3}
print(my_set) # {1, 2, 3}

🔹 4. Dictionary
• Unordered (Python 3.7+ keeps insertion order)
• Mutable
• Key-Value pairs
• Keys must be unique, values can repeat
• Best for fast lookups and mappings

my_dict = {"name": "Alice", "age": 25}
print(my_dict["name"]) # Alice

Feature List Tuple Set Dictionary
Ordered ✅ (insertion order)
Mutable
Duplicates Keys ❌, Values ✅
Use Case Dynamic collection Fixed collection Unique items Key-value mapping

✨ Reflection
Understanding these four data structures has given me a strong foundation in Python. Now I can choose the right structure for the right problem, which is crucial in data analytics and real-world programming.

Next up → I’ll start exploring Python libraries that make coding even more powerful. 🚀

Python #DataStructures #100DaysOfCode #DevCommunity #LearningJourney


This content originally appeared on DEV Community and was authored by Aditi Sharma


Print Share Comment Cite Upload Translate Updates
APA

Aditi Sharma | Sciencx (2025-09-08T12:54:44+00:00) 🚀 Day 9 of My Python Learning Journey. Retrieved from https://www.scien.cx/2025/09/08/%f0%9f%9a%80-day-9-of-my-python-learning-journey/

MLA
" » 🚀 Day 9 of My Python Learning Journey." Aditi Sharma | Sciencx - Monday September 8, 2025, https://www.scien.cx/2025/09/08/%f0%9f%9a%80-day-9-of-my-python-learning-journey/
HARVARD
Aditi Sharma | Sciencx Monday September 8, 2025 » 🚀 Day 9 of My Python Learning Journey., viewed ,<https://www.scien.cx/2025/09/08/%f0%9f%9a%80-day-9-of-my-python-learning-journey/>
VANCOUVER
Aditi Sharma | Sciencx - » 🚀 Day 9 of My Python Learning Journey. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/09/08/%f0%9f%9a%80-day-9-of-my-python-learning-journey/
CHICAGO
" » 🚀 Day 9 of My Python Learning Journey." Aditi Sharma | Sciencx - Accessed . https://www.scien.cx/2025/09/08/%f0%9f%9a%80-day-9-of-my-python-learning-journey/
IEEE
" » 🚀 Day 9 of My Python Learning Journey." Aditi Sharma | Sciencx [Online]. Available: https://www.scien.cx/2025/09/08/%f0%9f%9a%80-day-9-of-my-python-learning-journey/. [Accessed: ]
rf:citation
» 🚀 Day 9 of My Python Learning Journey | Aditi Sharma | Sciencx | https://www.scien.cx/2025/09/08/%f0%9f%9a%80-day-9-of-my-python-learning-journey/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.