๐Ÿš€ 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.