𝗣𝘆𝘁𝗵𝗼𝗻 𝗖𝗼𝗹𝗹𝗲𝗰𝘁𝗶𝗼𝗻𝘀 – 𝗟𝗶𝘀𝘁 𝘃𝘀. 𝗦𝗲𝘁 🐍 When you're building a Python app, choosing the right data structure isn't just about syntax, it's about performance. I spent today breaking down the "Why" and "When" of Lists and Sets: 🔹 𝗨𝘀𝗲 𝗮 𝗟𝗜𝗦𝗧 𝘄𝗵𝗲𝗻: 1️⃣ You need to maintain the order of items. 2️⃣ You have duplicate data (e.g., a list of transaction amounts). 3️⃣ You need to access items by their position (Index). 🔸 𝗨𝘀𝗲 𝗮 𝗦𝗘𝗧 𝘄𝗵𝗲𝗻: 1️⃣ You need unique items only (Auto-removes duplicates). 2️⃣ Search speed is critical.Sets use Hashing for O(1) lookups. 𝗗𝗮𝘆 𝟭𝟰/𝟯𝟬 #30DaysOfCode #PythonLearning #DataStructures #Day14
Choosing Lists or Sets in Python for Performance
More Relevant Posts
-
𝗧𝗵𝗲 𝗣𝘆𝘁𝗵𝗼𝗻 "𝗥𝗲𝗳𝗲𝗿𝗲𝗻𝗰𝗲" 𝗧𝗿𝗮𝗽 I noticed something interesting today : changed a value inside a function, and it reflected outside too I didn’t return anything. I didn’t re-assign the variable ➡️ 𝗧𝗵𝗲 𝗖𝗮𝘁𝗰𝗵 : Python functions don't always create a new "𝗰𝗼𝗽𝘆" of your data Instead, they often work with 𝗮 𝗿𝗲𝗳𝗲𝗿𝗲𝗻𝗰𝗲 to the original object ▪️𝗠𝘂𝘁𝗮𝗯𝗹𝗲 𝗼𝗯𝗷𝗲𝗰𝘁𝘀 (Lists, Dicts, Sets) are modified in place. Any change inside the function affects the original data directly. ▪️𝗜𝗺𝗺𝘂𝘁𝗮𝗯𝗹𝗲 𝗼𝗯𝗷𝗲𝗰𝘁𝘀 (Integers, Strings,Tuples) are safe because they can't be changed in place. ➡️ 𝗧𝗵𝗲 𝗧𝗮𝗸𝗲𝗮𝘄𝗮𝘆 : If you’re working with Lists or Dictionaries and want to keep your original data safe, you must be explicit: update(my_list.copy()) Small detail, but missing it can lead to hours of debugging bugs #Python #30DaysOfCode #SoftwareEngineering #LearningInPublic #Day19
To view or add a comment, sign in
-
-
We didn’t need another dashboard. We needed a data application. This 7-slide carousel shows how that shift led to an App-as-Code model built with YAML, SQL, Python, and CI/CD. For anyone who wants the deeper write-up, I’ve added the full article with code base in the comments. #DataEngineering #AnalyticsEngineering #DataApps #AppAsCode #DataPlatform #ModernDataStack #CI_CD
To view or add a comment, sign in
-
📊 Day 27: Getting Started with Matplotlib As part of my continuous learning journey, I’m diving into Matplotlib — one of the most powerful data visualization libraries in Python. 🔹 What is Matplotlib? It’s a plotting library used to create static, animated, and interactive visualizations in Python. 🔹 Why it matters: - Turns raw data into insights - Helps communicate findings clearly - Widely used in Data Science & Engineering 🔹 First example: import matplotlib.pyplot as plt x = [1,2,3,4] y = [10,20,25,30] plt.plot(x, y) plt.title("Simple Line Plot") plt.xlabel("X-axis") plt.ylabel("Y-axis") plt.show() 📌 Simple, but powerful. This is the foundation of data visualization in Python. Tomorrow: Customizing plots 🎯 #M4ACELearningChallenge #LearningInPublic
To view or add a comment, sign in
-
Spent ₹0. Built a production-grade analytics pipeline. Here's the exact stack—layer by layer. Every tool is free. Every tool is used by real companies at scale. Swipe to steal it. 👇 — Bookmark this for your next project setup. Which layer of this stack are you strongest in? Tell me below. #DataAnalytics #Analytics #Python #SQL #DataEngineering #BusinessIntelligence #OpenSource
To view or add a comment, sign in
-
In large organizations, transitioning repetitive reporting tasks from Excel to Python isn’t just a technical upgrade, it’s a scalability decision. As data volume and complexity grow, automation, version control, and reproducibility become critical. Excel remains powerful for quick insights, but Python ensures consistency, auditability, and long-term efficiency across teams.
Data Analyst leveraging data science and business analysis skills. |Physics Made Easy, Educator (Online Tutor)
Stop the Excel vs. Python war. Here is the actual answer: Use Excel when: ✅ Your audience only knows Excel ✅ The dataset fits in rows you can see ✅ Speed of delivery beats reproducibility Use Python when: ✅ The same report runs every week ✅ Data has 100k+ rows ✅ You need auditability and version control Use BOTH when: ✅ You want a job in 2025 The best analysts do not pick sides. They pick the right tool. Tool tribalism is the enemy of good analysis. Master both. Charge more. Ship faster. Which tool do YOU default to — and why? Let's debate 👇 #Excel #Python #DataAnalysis #DataScience #Analytics
To view or add a comment, sign in
-
-
Stop the Excel vs. Python war. Here is the actual answer: Use Excel when: ✅ Your audience only knows Excel ✅ The dataset fits in rows you can see ✅ Speed of delivery beats reproducibility Use Python when: ✅ The same report runs every week ✅ Data has 100k+ rows ✅ You need auditability and version control Use BOTH when: ✅ You want a job in 2025 The best analysts do not pick sides. They pick the right tool. Tool tribalism is the enemy of good analysis. Master both. Charge more. Ship faster. Which tool do YOU default to — and why? Let's debate 👇 #Excel #Python #DataAnalysis #DataScience #Analytics
To view or add a comment, sign in
-
-
QuillSort — A data sorter Created by Isaiah Tucker Most of the time, Python’s built-in sorted() and list.sort() are all you need. But if you ever try to sort a lot of data—millions to billions of values, big numeric logs, or giant SQL exports—you quickly run into a wall: RAM, speed, or both. So I built Quill-Sort (quill-sort on PyPI). / ... link https://lnkd.in/eHaFZyx4 pubDate Wed, 01 Apr 2026 03:29:53 +0000
To view or add a comment, sign in
-
🆃🆈🅿🅴 🅲🅰🆂🆃🅸🅽🅶 🪄🐍 📦 𝗪𝗵𝗮𝘁 𝗶𝘀 𝗧𝘆𝗽𝗲 𝗖𝗮𝘀𝘁𝗶𝗻𝗴? Definition: Type Casting is the process of converting the value of one data type (integer, string, float, etc.) to another data type. Sometimes we have data in one format, but we need it in another to actually use it or perform math on it. In Python, we might have the number "5". It looks like a number, but because it’s in quotes, it’s a String (text). We can't multiply it until we "freeze" it into an Integer! 📝 𝐓𝐡𝐞 𝐓𝐰𝐨 𝐖𝐚𝐲𝐬 𝐭𝐨 𝐂𝐚𝐬𝐭 𝐈𝐦𝐩𝐥𝐢𝐜𝐢𝐭 𝐂𝐚𝐬𝐭𝐢𝐧𝐠: If we add an integer (5) and a float (2.5), Python automatically turns the result into a float (7.5) so we don't lose any data. 𝗘𝘅𝗽𝗹𝗶𝗰𝗶𝘁 𝗖𝗮𝘀𝘁𝗶𝗻𝗴:This is when we tell Python to change the type using built-in functions like int(), float(), or str(). #python #typecasting #datacleaning #dataanalytics #learningpython #pythonsimplified
To view or add a comment, sign in
-
-
C++ has the ability to zip arrays like Python in newer versions: #include<iostream> #include<ranges> #include<tuple> #include<span> float vecdot_product(std::span<const float> v1, std::span<const float> v2){ float sum = 0.0f; for( auto [a, b] : std::views::zip(v1,v2)){ sum += a * b; } return sum; } int main(){ float arr1[5] = {1,2,3,4,5}; float arr2[5] = {6,7,8,9,10}; float dotProduct = vecdot_product(arr1,arr2); std::cout << "Dot product = " << dotProduct << std::endl; } g++ vector-dot-product-zip-version.cpp -o vector-dot-product-zip-version.exe -std=c++23
To view or add a comment, sign in
-
This week I spent 2 hours debugging a pipeline that broke because of a subtle mutable default argument. Last week I finished DataCamp's "Intermediate Python for Developers" - and guess what chapter was in there. Funny how that works sometimes. A few takeaways that'll stick with me: • Mutable defaults are a trap, even for people who "know Python" • Decorators aren't magic - they're just functions returning functions (but the mental model matters) • Comprehensions > loops, until they don't fit on one screen anymore Working with Python daily on dbt models, and data transformations, it's easy to get comfortable in a narrow slice of the language. Stepping back to revisit the fundamentals consistently makes my production code cleaner. What's your approach - do you block time for structured learning, or learn purely on the job? #Python #DataEngineering #LearningInPublic
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
I think list is same like arrays in c+-