Topic 7/100 🚀 🧠 Topic 7 — Lambda Functions Want to write a quick function in just one line? ⚡ 👉 What is it? Lambda functions are small anonymous functions defined using the lambda keyword. 👉 Use Case: Used in real-world applications for: Quick operations inside map(), filter() Sorting with custom logic Short, throwaway functions 👉 Why it’s Helpful: Reduces boilerplate code Makes code concise Useful for functional programming 💻 Example: # Normal function def square(x): return x * x # Lambda version square = lambda x: x * x print(square(5)) 🧠 What’s happening here? We replaced a full function definition with a single-line lambda expression. ⚡ Pro Tip: Use lambdas for small logic only — avoid them for complex functions. 💬 Follow this series for more Topics #Python #BackendDevelopment #100TopicOfCode #SoftwareEngineering #LearnInPublic
HIMANSHU MAHESHWARI’s Post
More Relevant Posts
-
Didn't know you could extract tables from a Word doc using Python until today. python-docx lets you loop through tables, pull cell data, and load it straight into a DataFrame. Spent some time cleaning it up — splitting on ':', transposing, fixing headers — but it worked. Also practiced groupby() and lambda functions inline. Small things but they make the code so much cleaner. Notebook here 👉 https://lnkd.in/dfTwrvqT #Python #Pandas #DataAnalysis #LearningInPublic
To view or add a comment, sign in
-
Topic 8/100 🚀 🧠 Topic 8 — Higher-Order Functions What if functions could take other functions as input… or even return them? 🤯 👉 What is it? Higher-order functions are functions that either: Accept other functions as arguments, OR Return a function as output 👉 Use Case: Used in real-world applications for: Functional programming patterns Data transformations (map, filter) Building reusable logic 👉 Why it’s Helpful: Promotes code reuse Makes logic more flexible Enables cleaner and modular design 💻 Example: def apply_operation(func, value): return func(value) def square(x): return x * x result = apply_operation(square, 5) print(result) 🧠 What’s happening here? We passed the square function as an argument to another function and executed it dynamically. ⚡ Pro Tip: Master this concept to unlock functional programming in Python. 💬 Follow this series for more Topics #Python #BackendDevelopment #100TopicOfCode #SoftwareEngineering #LearnInPublic
To view or add a comment, sign in
-
-
Topic 10/100 🚀 🧠 Topic 10 — Partial Functions What if you could pre-fill some arguments of a function and reuse it later? 🤯 👉 What is it? Partial functions allow you to fix a few arguments of a function and generate a new function with fewer parameters. 👉 Use Case: Used in real-world applications for: Pre-configuring functions Simplifying repeated function calls Building reusable utilities 👉 Why it’s Helpful: Reduces repetition Makes code cleaner Improves readability 💻 Example: from functools import partial def multiply(x, y): return x * y double = partial(multiply, 2) print(double(5)) # Output: 10 🧠 What’s happening here? We fixed the value of x = 2, creating a new function (double) that only needs one argument. ⚡ Pro Tip: Use partial functions when you find yourself passing the same arguments repeatedly. 💬 Follow this series for more Topics #Python #BackendDevelopment #100TopicOfCode #SoftwareEngineering #LearnInPublic
To view or add a comment, sign in
-
-
🚀 Learn Python in 30 Days (Simple Plan) Week 1: Basics 👉 Variables, data types, if-else, loops Week 2: Core Concepts 👉 Lists, dictionaries, functions, file handling Week 3: Intermediate 👉 OOP, modules, error handling + practice problems Week 4: Real Skills (choose one) 💻 Web (Flask) 📊 Data Science (Pandas, NumPy) 🤖 Automation (scripts, bots) Daily Routine (1–2 hrs): ✔ Learn → Practice → Build 💡 Tip: Don’t just watch tutorials — code every day. #Python #Coding #LearnToCode #Developer
To view or add a comment, sign in
-
-
🚀 Day 75 of #100DaysOfCode 🔥 LeetCode 179 – Largest Number 💡 Problem: Given a list of non-negative integers, arrange them such that they form the largest possible number. 🧠 Key Insight: Normal sorting won't work here ❌ We need a custom comparator based on string concatenation. 👉 Compare: - ""a + b"" vs ""b + a"" - Whichever gives a larger value should come first. ⚙️ Approach: 1. Convert numbers to strings 2. Sort using custom comparison logic 3. Join the result 4. Handle edge case (like "[0,0] → "0"") ⚡ Complexity: - Time: O(n log n) - Space: O(n) 🎯 Result: ✅ Accepted ⚡ Runtime: 0 ms (100%) 📌 Lesson Learned: Sometimes sorting logic depends on combination, not value. #LeetCode #Python #CodingJourney #DSA #100DaysOfCode #Sorting #ProblemSolving
To view or add a comment, sign in
-
-
Topic 5/100 🚀 🧠 Topic 5 — Iterators Ever wondered how a for loop actually works behind the scenes? 🤔 This is the concept powering it. 👉 What is it? Iterators are objects that allow you to traverse through data step-by-step using __iter__() and __next__() methods. 👉 Use Case: Used in real-world applications for: Custom data pipelines Streaming data Building your own iterable objects 👉 Why it’s Helpful: Gives full control over iteration Enables custom looping logic Foundation for generators 💻 Example: class Counter: def __init__(self, max): self.max = max self.current = 0 def __iter__(self): return self def __next__(self): if self.current < self.max: self.current += 1 return self.current raise StopIteration for num in Counter(3): print(num) 🧠 What’s happening here? We created a custom object that behaves like a loop by controlling how values are returned one by one. ⚡ Pro Tip: If you understand iterators, you’ll unlock how Python handles loops internally. 💬 Follow this series for more Topics #Python #BackendDevelopment #100TopicOfCode #SoftwareEngineering #LearnInPublic
To view or add a comment, sign in
-
-
environment maintenance isn't "extra" work—it's the work. If you aren't keeping your dependencies updated, you aren't building a product; you're building a ticking time bomb for the next dev who touches it. HERE IS WHY I SAY THAT I was plugging in this spects frame measurement tool, and the client was like, "The code is proven, just drop it in." Wrong. The second I opened the hood, I hit straight-up Dependency Hell. This "proven" code was a total time capsule—ancient versions of MediaPipe, NumPy, and OpenCV that were basically at war with my modern Python setup. I had three choices: Downgrade the entire codebase and live in the past. Rebuild the core logic from scratch. Drag the codebase into the modern stack. -I've dragged the codebase back into the modern stack let me know what would you do if you had such a situation #softwareEngineering #Python #fundamentals
To view or add a comment, sign in
-
-
Most FastAPI codebases look clean at first glance. Until you try to change something. I’ve noticed a pattern — a lot of complexity doesn’t come from the problem itself, but from where the logic lives. When routes start handling more than just request/response, things get harder to reason about. Lately, I’ve been keeping one constraint: Routes should stay thin. They handle the HTTP layer. All business logic moves to services. It’s a small shift, but it changes a lot: 1) Clearer separation of concerns 2) Easier testing 3) Fewer side effects when making changes Also started appreciating dependency injection more. Not as a framework feature, but as a way to keep things decoupled and predictable. Nothing groundbreaking here. But in a time where a lot of code is being generated faster than it’s being designed, maintainability comes down to how consistently we apply these basics — not whether we know them. Curious how others approach structuring FastAPI projects at scale. #FastAPI #BackendDevelopment #CleanCode #SoftwareEngineering #Python
To view or add a comment, sign in
-
Here is an event scheduler I made in python that can handle creating a new event to be scheduled, cancel one by ID, update the priority, peek at the next one, pop the one ahead, outputs the events that are in an array, load a sample data. The point of this was to create a program where we learn about the implementation of heaps, hash table and ordered structure in an algorithmic setting.
To view or add a comment, sign in
-
New blog post! Live Life on the Edge: A Layered Strategy for Testing Data Models This post is about a three-layer testing pattern for complex software systems I've landed on in python: structural coverage with Polyfactory, value-level probing with Hypothesis, cross-field invariants with icontract. Includes a practical example, an honest tradeoffs section, and a note on what schema-first design and consumer-driven contract testing solve instead. Link in comments. #Python #SoftwareTesting #SoftwareArchitecture #Pydantic #PropertyBasedTesting
To view or add a comment, sign in
-
More from this author
-
🚀 Just Took My First Steps with the OpenAI Python API — Here's How Easy It Is!
HIMANSHU MAHESHWARI 2mo -
Beyond the Hype: A Practical Guide to Integrating AI & ML Into Your Projects
HIMANSHU MAHESHWARI 6mo -
🧠 Laravel Jobs & Queues vs Django Celery: A Backend Developer's Guide to Async Task Management 🚀
HIMANSHU MAHESHWARI 1y
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