Python Clarity Series – Episode 13 Topic: *args and **kwargs Simplified 🤯 What are *args and **kwargs? Students fear this syntax. Let’s simplify. def total(*numbers): return sum(numbers) print(total(1, 2, 3)) 👉 *args collects multiple positional arguments into a tuple. Now: def student(**details): print(details) student(name="Ravi", marks=90) 👉 **kwargs collects named arguments into dictionary. 💡 Memory Trick: → Tuple ** → Dictionary This is heavily used in frameworks and advanced coding. Not hard. Just unfamiliar. #PythonConcepts #FutureDevelopers #LearnPython
Understanding *args and **kwargs in Python
More Relevant Posts
-
Python Clarity Series – Episode 16 Topic: range() Confusion (Start, Stop, Step) 📌 range() looks simple… but many students misunderstand it. Basic form: range(start, stop, step) Example: for i in range(2, 10, 2): print(i) Output: 2 4 6 8 👉 start → where counting begins 👉 stop → where counting stops (NOT included) 👉 step → increment value ⚠️ Important rule: range() always excludes the stop value. 💡 Memory Trick: Range goes UP TO but not INCLUDING the stop value. Example: range(5) Output: 0 1 2 3 4 Students often expect 5 — but it never appears. Small detail. Big exam mistake. #PythonBasics #LoopConcepts #StudentLearning
To view or add a comment, sign in
-
-
Day 69 Some problems look hard… until they teach you something valuable. #Day69 🧩 295. Find Median from Data Stream A challenging problem, but a great one for learning. What it teaches: • Using two heaps (min heap + max heap) together • Keeping the data stream balanced • Understanding how median changes with every insertion This problem really makes you think about the structure of data, not just the code. The more I analyze it from different angles, the clearer it becomes. Definitely one of those questions that deserves revision. Hard problems often become the best teachers. #LeetCode #DSA #Python #Heap #PriorityQueue #LearningInPublic #Consistency
To view or add a comment, sign in
-
-
Day2 & 3✅️ What's harder — learning Python or just showing up every day? Asking because Day 2 & 3 just became one post. Not perfect but not quitting either. 🤷♀️ Here's what got done: 🔁 Loops — for, while, nested. Practiced with real examples. 🔀 Conditionals — if, elif, else. Sounds easy until it isn't. 🧩 Functions — where it finally started feeling like actual coding. 📦 Data Structures — Lists, Tuples, Sets, Dictionaries. All of them. Done. Two days. Lots of concepts. Some confusion. More clarity. Day 4 is already in progress — dropping that tomorrow. 👀 #Python #LearningInPublic #100DaysOfCode #DataAnalytics #PythonForDataScience #CSEStudent
To view or add a comment, sign in
-
Day 2 – Understanding Numbers in Python 🚀 Learning in public and rebuilding my foundations from scratch. Today I focused on Python’s numeric system: • Difference between integers and floats • Arithmetic operators: +, -, *, /, //, %, ** • Operator precedence and why 2 ** 3 ** 2 = 512 • Scientific notation (2.3e4, 2.3e-3) • Rounding vs math.floor() vs math.ceil() • Why negative modulus works differently in Python • How floor division and modulus follow the identity: a = (a // b) * b + (a % b) • Using the math module (sqrt, floor, ceil, pi) Big takeaway: Understanding number behavior removes 90% of beginner confusion in Python. Strong foundations. One layer at a time. 💪 #Python #DataScience #LearningInPublic
To view or add a comment, sign in
-
-
What Debugging My DSA Mistakes Taught Me Recently, I realized something: The real learning didn’t happen when I got the solution right. It happened when I got it wrong. - Popped from a stack twice in one line. - Confused floor division with truncation in Python. - Stored values instead of indices and broke duplicate cases. - Used Kadane where prefix sum was required. Each mistake exposed a hidden assumption. I stopped memorizing patterns and started understanding invariants. The biggest shift wasn’t solving harder problems, it was asking better “why” questions. #DSA #Algorithms #Python
To view or add a comment, sign in
-
Most beginners think a variable is a complicated concept. It is not. A variable is just a labelled box. 📦 name = 'Haris' This means: → Create a box → Put a label on it that says 'name' → Put 'Haris' inside the box That is it. age = 20 → a box labelled age holding 20 score = 98.5 → a box labelled score holding 98.5 Python is just organizing boxes. Once I understood this, everything else made sense. I am currently on Week 1 of documenting my Python journey publicly. If you are learning too — follow along. 🧵 What concept confused you most when you started programming? 👇 #Python #Programming #LearnPython #BuildingInPublic #AI #MachineLearning #100DaysOfCode #TechPakistan
To view or add a comment, sign in
-
Day 22/30 30DaysLearningChallenge with TS Academy Today, i learnt that file handling in Python is similar to working with a diary. You open it to either read or write, check what is already inside or add new notes, and then close it when you are done. I also learnt how to open a file using the open() function. The read() method allows viewing of the contents of a file without making any changes, the write() method replaces the existing content with new information, and the append method allows addition of new data to the existing content without deleting what is already there. Additionally, i learnt about context managers, which automatically closes a file after opening it. Lastly, i understood the importance of closing files properly. If a file is not closed, it can lead to wasted memory, make the file inaccessible to other programs, and sometimes prevent data from being fully written to the disk. #30DaysOfTech #DataScience #LearningWithTS
To view or add a comment, sign in
-
Today I focused first on Python fundamentals that are essential for practical coding: • Functions help organize logic into reusable blocks, making programs cleaner and easier to manage. • Modules allow code reuse and structure, whether importing built-in ones like math or creating custom ones. • File Handling connects programs to external data, enabling reading, writing, and updating files. These basics form the foundation for building larger, real-world applications. Later, I continued with DSA problem-solving and worked through: 1. Intersection of Two Arrays II – practicing frequency maps to handle duplicates. 2. Jump Game II – applying greedy strategies to minimize jumps. 3. Triangle – solving a DP problem to find the minimum path sum from top to bottom. 4. Unique Binary Search Trees – learning how Catalan numbers and DP combine to count BSTs. #Python #DSA #Leetcode #DynamicProgramming #Functions #Modules #FileHandling #CodingJourney #LearningEveryday
To view or add a comment, sign in
-
-
𝗗𝗮𝘆 𝟭𝟲 - 𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻𝘀 𝗶𝗻 𝗣𝘆𝘁𝗵𝗼𝗻 𝗪𝗵𝗮𝘁 𝗶𝘀 𝗮 𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻? A function is a reusable block of code designed to perform a specific task. Think of function like: • A blender in the kitchen • A calculator for calculations • A washine machine for cleaning clothes You give it input → It processes → It gives output. In Python: 👉 A function helps us organize logic and avoid repetition. 𝙒𝙞𝙩𝙝𝙤𝙪𝙩 𝙛𝙪𝙣𝙘𝙩𝙞𝙤𝙣𝙨: • Code becomes repetitive • Programs become messy • Debugging becomes difficult. 𝙒𝙞𝙩𝙝 𝙛𝙪𝙣𝙩𝙞𝙤𝙣𝙨: • Code becomes modular • Reusable • Structured 𝗜 𝗹𝗲𝗮𝗿𝗻𝘁 𝘁𝗵𝗮𝘁 𝗮𝘀 𝗮 𝗱𝗮𝘁𝗮 𝘀𝗰𝗶𝗲𝗻𝘁𝗶𝘀𝘁, 𝗳𝘂𝗻𝗰𝘁𝗶𝗼𝗻𝘀 𝗵𝗲𝗹𝗽 𝘂𝘀: • Clean datasets • Compute metrics • Structure machine learning workflows. How is the learning going, my TS Academy cohorts? #TSAcademy #LearningWithTS #DataScienceJourney #DoHardThings
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