Do you know a Python Set is like a group of friends? 👥🐍 In a group of friends, you usually don’t have duplicate people. Each person is unique. 🙋♂️🙋♀️ Python Sets work the same way — they do not allow duplicate values. ❌🔁 Another interesting thing is that a group of friends doesn’t stand in a fixed order. People can stand anywhere. 🚶♂️🚶♀️ Just like that, Sets in Python are unordered, which means items do not have a fixed position or index. 🔢❌ Example: friends = {"Alex", "John", "Maya", "Alex"} print(friends) Even if "Alex" appears twice, the Set will keep only one value, because duplicates are automatically removed. 🧹✨ #Python #PythonLearning #CodingTips #Programming #LearnToCode #PythonBasics #Sets
Python Sets: Unique and Unordered Collections
More Relevant Posts
-
Understanding Conditional Statements & Boolean Logic in Python mastering conditionals and booleans is a must. These are the building blocks that help your program make decisions — just like we do in real life. * What is a Boolean? A Boolean value can only be: True False * Example: is_logged_in = True print(is_logged_in) * Conditional Statements (if-else) They help your program decide what to do based on conditions. * Example: age = 18 if age >= 18: print("You are eligible to vote") else: print("You are not eligible to vote") * Using Boolean in Conditions is_member = True if is_member: print("Access granted") else: print("Access denied") * Multiple Conditions (elif) marks = 75 if marks >= 90: print("Grade A") elif marks >= 70: print("Grade B") else: print("Grade C")
To view or add a comment, sign in
-
Learning Python step by step and had a small “aha!” moment today while comparing Python lists with NumPy arrays. 👩💻 Here’s the simple way I started thinking about it: 🔹 Python Lists Great for general use Flexible (can hold different data types) But when doing calculations, you usually need loops… which can get slow and a bit tiring for large data. 🔹 NumPy Arrays Designed for numerical operations Much faster for calculations Works naturally with multi-dimensional data (matrices, vectors, etc.) Lets you perform operations on entire arrays at once without writing loops. 💡 My beginner takeaway: If you're just storing data → lists are totally fine. If you're doing heavy calculations or working with numerical data → NumPy becomes a game changer. Still learning and connecting the dots every day, but moments like this make Python even more fun to explore. 🚀 #Python #NumPy #PythonLearning #CodingJourney #BeginnerProgrammer
To view or add a comment, sign in
-
Python Learning Update — Floating Point Precision Today I explored an interesting concept in Python about floating point numbers and precision errors. While experimenting, I discovered something surprising: "0.1 + 0.2" does not exactly equal "0.3" in Python. This happens because computers store decimal numbers in binary floating-point format, which can create very small precision differences. 📚 What I learned from this exercise: • Understanding floating-point precision issues • Why "0.1 + 0.2" may not exactly equal "0.3" • Using "round()" to control decimal precision • Using "math.isclose()" for reliable floating-point comparison • Importing and using Python modules ("import math") • Taking decimal inputs from users with "float()" • Building a small mini calculator for decimal numbers This exercise helped me understand how computers handle decimal numbers internally and how to write safer comparisons in Python. #Python #LearningPython #CodingJourney #ProgrammingBasics #PythonTips
To view or add a comment, sign in
-
-
Most Python beginners get confused with this concept. List vs Dictionary. Both store data. But they work very differently. List: • Stores values in order • Access using index • Example: numbers = [10, 20, 30] Dictionary: • Stores data as key-value pairs • Access using keys • Example: student = {"name": "Mani", "age": 25} So when should you use them? 👉 Use a List when order matters 👉 Use a Dictionary when you want labeled data 👉 Did you know this difference before? #BluJayTechnologies #Python #SoftwareCoaching #ListVsDictionary
To view or add a comment, sign in
-
-
🐍 Friday Python Question What happens here? 👇 a = "hello" a = a + " world" Is it still the same a? or a completely different object*? 🤔 Did we modify the original string? Did Python create something new behind the scenes? 🥚 Short answer - yes, Python did create something. 🐍 Python strings are immutable objects, so you can’t change them in place. When you do: a = a + " world" Python actually: creates a new string "hello world" and reassigns a to this new object, so it’s a different object in memory. How can you verify it? Use id(): a = "hello" print(id(a)) a = a + " world" print(id(a)) Absolutely different ids. * Understanding that everything in Python is an object explains decorators, metaclasses, and why you can pass functions as arguments. #Python #Coding #Programming #TechFriday
To view or add a comment, sign in
-
Really excited to share my week1 python learning blog. Topic: variables and data Types In this article ,I have covered up by exploring the fundamentals of python including variables, examples and , data types as well with the common bugs with the solutions. please read here: https://lnkd.in/gryZb6-t #python #programing #Learningjourney#GitHub #Coding#Developers
To view or add a comment, sign in
-
🚀 Learn Python – Sets If you want to learn how to handle unordered, unique collections of data, mastering Sets in Python is essential. They are the ultimate tool for automatic duplicate removal. I’ve created a structured learning section on my website that explains sets step-by-step with practical examples. 📚 Explore the tutorial: https://lnkd.in/g7pykaF9 🔹 What you will learn • Creating sets with curly braces {} and the set() function • Automatic duplicate removal for data cleaning • Understanding unordered and unindexed collections • Making empty sets correctly (set() vs {}) • Use cases: Mathematical operations and unique value filtering This resource is designed to help developers learn Python with practical examples and structured lessons. Happy Learning! 🚀 #Python #Coding #DataScience #LearnPython #Programming #PythonBasics
To view or add a comment, sign in
-
In Python, if we write: a = b = [ ] Are we creating two lists or just one? Actually, Python creates only one list in memory, and both variables "a" and "b" reference the same object. This happens because assignment in Python doesn’t copy objects. Instead, it simply makes the variables point to the same object in memory. Let’s look at a simple example: a = b = [ ] a.append(1) print(a) print(b) Output: [1] [1] Even though we only modified "a", "b" changed as well. That’s because both variables are referencing the same list. If you want two independent lists, you should create them separately: a = [ ] b = [ ] 📌 Key takeaway: In Python, variables store references to objects, not the objects themselves. #Python #Programming #DataScience #AI #Instant
To view or add a comment, sign in
-
✅Day 7 – Tuples, Sets, and Dictionaries in Python Today I explored three important Python data structures: Tuples, Sets, and Dictionaries. Each of them stores data differently and serves different purposes. ✅What I Learned -- Tuple → Similar to a list but cannot be changed after creation. -- Set → Stores unique values and removes duplicates. -- Dictionary → Stores data in key–value pairs. Example: student = {"name": "Tauhid", "age": 23} ✅In data analytics, dictionaries are very useful for organizing structured data, while sets help remove duplicate values. ✅Today’s takeaway: -- Choosing the right data structure makes data handling much easier. -- One more step forward in my Python learning journey. #Python #DataAnalytics #LearningJourney #BusinessAnalytics #Consistency
To view or add a comment, sign in
-
-
Something shifted for me this week. I stopped learning Python. And started using it. There's a difference, and it's everything. Learning is following a tutorial, reproducing what someone shows you, and feeling clever when it works. Using is sitting in front of a blank file with a real problem and figuring it out. This week I built a script that analyzes weekly sales data for 6 products, calculates totals and averages, flags low-volume items, and saves results to CSV. Nobody told me how to structure it. I just built it. I broke it 4 times. Fixed it 4 times. And when it finally ran cleanly and printed the summary I needed that felt different from any tutorial win. That's the moment I think people mean when they say "it clicked." Not when you understand the syntax. When you forget about the syntax and just solve the problem. Have you had that moment yet? #Python #LearningInPublic #SupplyChain #BuildInPublic
To view or add a comment, sign in
More from this author
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
Impressive 🎉♥️