Sidra NL’s Post

Python Dictionaries & Sets! ⚡ Today I explored two fundamental Python data structures: dictionaries and sets. Both are incredibly powerful, but they behave very differently. 1. Dictionaries: Dictionaries store key-value pairs and preserve insertion order. They’re perfect for structured data like student info or inventory: info = {"name": "Sidraa", "age": 24} info["new_member"] = "Danny" print(info) 👉Output: {'name': 'Sidraa', 'age': 24, 'new_member': 'Danny'} 2. Sets: Sets are unordered collections of unique items. They’re great for membership tests, removing duplicates, and performing mathematical set operations: cluster = {1, 3, 5} cluster.add(100) print(cluster) 👉Output: {1, 3, 5, 100} ✅ Key takeaway: 👀Dictionaries = labeled, ordered, mutable 👀Sets = unique, unordered, mutable and have immutable elements -------------------------- 🤓 Check Out More About Python Dictionaries and Sets in my recent Jupyter Notebook! -------------------------- ☺️ Here are Python (Beginner to Intermediate) GitHub Repos for you: 📁Python Variables: https://lnkd.in/e9rjz-_D 📁Python Operators: https://lnkd.in/e6hzgHSn 📁Python Conditionals: https://lnkd.in/egQNGZBF 📁Python Loops: https://lnkd.in/eezUg_-y 📁Python Functions: https://lnkd.in/eKdU6nex 📁Python Lists & Tuples: https://lnkd.in/eZ8KiQNs 📁Python Dictionaries & Sets: https://lnkd.in/eDmgj7pc ------------------------- ⚡ Follow my learning journey: 📎 GitHub: https://lnkd.in/ehu8wX85 🔗GitLab: https://lnkd.in/eiiQP2gw 💬 Feedback: I’d love your thoughts and tips! 🤝 Collab: If you’re also exploring Python, DM me! Let’s grow together! -------------------------- 📞Book A Call With Me: https://lnkd.in/e23BtnR9 -------------------------- #pythondictionaries #pythonsets #pythonprogramming #pythonforbeginners #pythonfornewbies #pythonlanguage

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories