🚀 Day 8 of My Python Learning Journey – Sets & Data Structures in Python

Today, I wrapped up learning about Sets and explored more about data structures in Python.

🔹 What are Sets?
• Unordered collections of unique elements.
• Defined using curly braces {}.
• No duplicates allowed.

fruits = {“apple”, “banana”, “cherry”, “…


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

Today, I wrapped up learning about Sets and explored more about data structures in Python.

🔹 What are Sets?
• Unordered collections of unique elements.
• Defined using curly braces {}.
• No duplicates allowed.

fruits = {"apple", "banana", "cherry", "apple"}
print(fruits) # {'apple', 'banana', 'cherry'}

🔑 Common Set Operations

a = {1, 2, 3}
b = {3, 4, 5}

print(a.union(b)) # {1, 2, 3, 4, 5}
print(a.intersection(b)) # {3}
print(a.difference(b)) # {1, 2}
print(a.symmetric_difference(b)) # {1, 2, 4, 5}

âś… Sets are very useful for mathematical operations, filtering, and removing duplicates.

🔹 Why Use Sets?
• Fast membership testing (in operator).
• Automatically remove duplicates.
• Great for mathematical/logical operations.

🔹 Data Structures Recap in Python

  1. List → Ordered, mutable.
  2. Tuple → Ordered, immutable.
  3. Set → Unordered, unique items.
  4. Dictionary → Key-value pairs.

Each data structure has its own strengths depending on the use case (speed, immutability, uniqueness, etc.).

🎯 Reflection

Sets introduced me to powerful operations for handling unique data. Understanding Python’s core data structures is essential because they form the foundation of problem-solving, algorithms, and real-world applications.

⚡ Next up: I’ll dive into libraries and explore advanced coding practices.

Python #100DaysOfCode #LearningJourney #DataStructures


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-05T08:18:26+00:00) 🚀 Day 8 of My Python Learning Journey – Sets & Data Structures in Python. Retrieved from https://www.scien.cx/2025/09/05/%f0%9f%9a%80-day-8-of-my-python-learning-journey-sets-data-structures-in-python/

MLA
" » 🚀 Day 8 of My Python Learning Journey – Sets & Data Structures in Python." Aditi Sharma | Sciencx - Friday September 5, 2025, https://www.scien.cx/2025/09/05/%f0%9f%9a%80-day-8-of-my-python-learning-journey-sets-data-structures-in-python/
HARVARD
Aditi Sharma | Sciencx Friday September 5, 2025 » 🚀 Day 8 of My Python Learning Journey – Sets & Data Structures in Python., viewed ,<https://www.scien.cx/2025/09/05/%f0%9f%9a%80-day-8-of-my-python-learning-journey-sets-data-structures-in-python/>
VANCOUVER
Aditi Sharma | Sciencx - » 🚀 Day 8 of My Python Learning Journey – Sets & Data Structures in Python. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/09/05/%f0%9f%9a%80-day-8-of-my-python-learning-journey-sets-data-structures-in-python/
CHICAGO
" » 🚀 Day 8 of My Python Learning Journey – Sets & Data Structures in Python." Aditi Sharma | Sciencx - Accessed . https://www.scien.cx/2025/09/05/%f0%9f%9a%80-day-8-of-my-python-learning-journey-sets-data-structures-in-python/
IEEE
" » 🚀 Day 8 of My Python Learning Journey – Sets & Data Structures in Python." Aditi Sharma | Sciencx [Online]. Available: https://www.scien.cx/2025/09/05/%f0%9f%9a%80-day-8-of-my-python-learning-journey-sets-data-structures-in-python/. [Accessed: ]
rf:citation
» 🚀 Day 8 of My Python Learning Journey – Sets & Data Structures in Python | Aditi Sharma | Sciencx | https://www.scien.cx/2025/09/05/%f0%9f%9a%80-day-8-of-my-python-learning-journey-sets-data-structures-in-python/ |

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.