Here's a quick Python tuple unpacking challenge from @dontmisstmr — can you get it right without running the code? nums = (10, 20, 30, (40, 50, 60)) x, y, z, nested = nums a, b, c = nested print(f"{z} and {b}") Tuple unpacking is one of those Python features that looks simple but trips people up the moment nesting gets involved. Drop your answer in the comments — and if you got it wrong, what threw you off? #Python #SoftwareDevelopment #CodingChallenge #ProgrammingTips #TechCommunity
More Relevant Posts
-
A small yet confusing mistake made with Python 🐍 You may think you’re creating a tuple here: x = (5) But you’re not ✖️ This is simply an integer. ❓ Why? Because in Python, ⭐ tuple creation involves a comma, not parentheses alone ✔️ The right way to do it: x = (5,) Now it’s a tuple. Even like this works: x = 5, ❓ Simple rule of thumb: Brackets only group items, but the comma makes it a tuple. Tiny point — but crucial! #Python #CodeTutorials #ProgrammingMistakes #CodingForNewbies #DevTips #100DaysOfCode #PythonTips #ProgrammingTips
To view or add a comment, sign in
-
-
Here's a Python dictionary merge challenge from @dontmisstmr — can you get it right without running the code? dict1 = {"name": "Alice", "age": 25} dict2 = {"city": "Noida", "age": 26} merged = dict1 | dict2 print(merged) The | operator was introduced in Python 3.9. When both dicts share a key, which value wins? Drop your answer in the comments! #Python #SoftwareDevelopment #CodingChallenge #ProgrammingTips #TechCommunity
To view or add a comment, sign in
-
One mistake that makes your code slower (and most beginners don’t notice): Using lists for lookups. There’s a faster, cleaner way — and it’s built into Python. Watch this. #Python #ProgrammingTips #DeveloperGrowth #CodingJourney #TechCareers #PythonDeveloper
To view or add a comment, sign in
-
🚀 Stop doing this in Python: it turns O(n) into O(n²) without you noticing In Python (and many other languages), strings are immutable. That means every time you concatenate a string, a new object is created instead of modifying the existing one. So if you do this repeatedly inside a loop, you’re not really “adding” to the string, you’re rebuilding it from scratch again and again, which becomes increasingly expensive. Reference: https://lnkd.in/gt_gw3bZ #python #coding #pythontips #pythonprogramming
To view or add a comment, sign in
-
-
Day 4 – Python Deep Dive 🚀 Topic: Mutable vs Immutable Immutable: int, string, tuple Mutable: list, dictionary Example: x = "hello" x[0] = "H" ❌ (error) 👉 Key takeaway: Immutable objects cannot be changed after creation. This impacts memory and performance. #Python #DeveloperThinking
To view or add a comment, sign in
-
-
Day 4/30 – Python 🐍 Today I learned about lists in Python how to store multiple values and perform operations like append, remove, and slicing. Practiced a few problems and started understanding how powerful data structures can be. Getting better every day 📈 #Day4 #Python #CodingJourney #LearningInPublic
To view or add a comment, sign in
-
Theory is great, but execution matters. Check out this 60-second visual breakdown on how to actually code outlier detection in Python. We're using pandas and scipy to implement both IQR Capping and Z-Score Dropping so your models stop skewing. #Part2 #DataScience #MachineLearning #Python #Pandas #DataEngineering #DataCleaning #TechEducation
To view or add a comment, sign in
-
I expected Python to feel like magic immediately. It didn't. What actually happened: - I spent 40 minutes on indentation errors - I wrote my first function and it felt oddly satisfying - I realized how readable Python is compared to what I imagined If you're also in the early stages — this is your sign to keep going. The confusion is part of it. What was YOUR first Python/AI moment? #Python #LearningInPublic #AIJourney #100DaysOfCode #PakistanTech
To view or add a comment, sign in
-
Day 5 – Python Deep Dive 🚀 Topic: Type Checking Example: x = 10 print(type(x)) 👉 Key takeaway: Understanding types helps prevent bugs. Also explored: isinstance() #Python #Debugging
To view or add a comment, sign in
-
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