Day 18: Today i explored how Python handles memory efficiently using Generators 🔹 What I learned and practiced: ✔️ Generators Functions that return an iterator and produce values one at a time. Great for saving memory when working with large datasets. ✔️ yield Keyword Used to produce a value and pause the function execution. It resumes from the same point when called again, unlike a normal return. ✔️ next() Function Used to retrieve the next value from the generator. Automatically stops when no more values are left to produce. ✔️ Created a square_gen() function to generate squares of numbers one by one. Key takeaway: Generators and yield are powerful tools for writing smarter, more efficient code by only processing what we need, when we need it.and also push in github #Python #codegnan #LearningPython
Python Memory Efficiency with Generators
More Relevant Posts
-
While learning LangGraph, one small Python concept suddenly became much more important to me: TypedDict. At first, I thought it was just “type annotations for dictionaries.” Useful, sure—but nothing special. Then I started thinking about state. When multiple nodes in a workflow keep reading and updating shared data, an unstructured dict becomes chaos very quickly. - Missing keys. - Unexpected values. - Confusing debugging. TypedDict solves that by forcing structure into state. That was my takeaway: - Sometimes tools that look “optional” become essential once systems start growing. #Python #BackendDevelopment #LangGraph #AIEngineering #BuildInPublic
To view or add a comment, sign in
-
I used to think errors were just problems… now I’m learning they’re part of the design. Today’s Python MahaRevision ⚙️ Chapter 12: Advanced Python (Part 1) This chapter felt like moving from basics to writing more robust code: → Exception handling (try-except) → Raising exceptions → try with else & finally → global keyword → __name__ == __"main"__ → enumerate function → List comprehensions A lot of small concepts—but each one adds more control and clarity to how code behaves. Practice set done: Handled errors in programs, experimented with custom exceptions, used enumerate for cleaner loops, and practiced writing compact code using list comprehensions. Some parts were new, some a bit tricky… but overall it felt like leveling up from just writing code to writing better code. Still learning, still improving. #Python #LearningInPublic #CodingJourney #Programming #AdvancedPython
To view or add a comment, sign in
-
🚀 Learning Something New Every Day! Today I learned an important Python concept — *args and **kwargs. 🔹 *args allows a function to take multiple positional arguments (stored as a tuple) 🔹 **kwargs allows a function to take multiple keyword arguments (stored as a dictionary) 💡 This makes functions more flexible and reusable in real-world scenarios. Here’s a simple example: def demo(*args, **kwargs): print(args) print(kwargs) Step by step, I’m strengthening my Python fundamentals and building a strong base for data analytics. #Python #LearningJourney #Coding #DataAnalytics
To view or add a comment, sign in
-
🚀 Python Practice – Function Examples Taking my Python learning a step further by practicing real-world function-based problems 🐍 In this session, I worked on: ✔️ Temperature Conversion (Celsius ↔ Fahrenheit) ✔️ Password Strength Checker ✔️ Shopping Cart Total Cost Calculator ✔️ Palindrome Checker ✔️ Factorial using Recursion These examples helped me understand how functions can be used to solve practical problems and write reusable, structured code. A big thanks to Krish Naik Sir for his amazing teaching and clear explanations 🙌 Documented all my practice in a Jupyter Notebook and shared it as a PDF to track my progress. Learning by building real logic step by step 📊 #Python #Functions #Practice #LearningJourney #DataAnalytics #Coding
To view or add a comment, sign in
-
🚀 Day 24/30 – Context Managers & with Statement in Python Today, I learned a cleaner and safer way to handle resources in Python. 📌 Context Managers They manage resources like files automatically — opening and closing them without extra code. 📌 with Statement Ensures proper setup and cleanup, even if an error occurs. Example: with open("data.txt", "r") as file: content = file.read() print(content) No need to manually close the file — Python handles it. 💡 Key Takeaway: Using with makes code cleaner, safer, and more professional. It’s a small change that improves reliability in real-world applications. Day 24 complete ✅ #Python #30DaysChallenge #LearningInPublic #ProgrammingJourney #Consistency #TechGrowth Aditya ChaturvediJECRC University
To view or add a comment, sign in
-
-
#Day12 of learning Python 🐍 Today I learned about file handling in Python and how to work with files using different modes like read (r), write (w), and append (a). Also explored using the with statement (context manager) to handle files more safely and efficiently. Practiced tasks like counting words in a file, checking whether a specific word exists, and building a small function to verify if a password exists inside a file. Also revised how try–except–finally helps handle file-related errors like missing files. Working with files made me realize how Python programs can store and retrieve real data, which is an important step toward building practical applications. Day 12 complete — 88 days to go! 🚀 #Day12 #PythonLearning #FileHandling #PythonFiles #100DaysOfLearning #CodingJourney #SkillShikshya
To view or add a comment, sign in
-
📘 Python Learning – Day 8 Highlights 🐍 Today’s class was about writing smarter and more flexible functions 👇 🔹 Variable Scope & LEGB Rule: Learned how Python searches variables → Local → Enclosing → Global → Built-in 🔹 Local vs Global Variables: Understanding where variables can be accessed and used 🔹 Advanced Arguments: ✔ *args → handles multiple positional arguments (as tuple) ✔ **kwargs → handles keyword arguments (as dictionary) 🔹 Flexible Functions: Created functions that can take unlimited inputs and return dynamic results 💡 Example: def add(*args): return sum(args) Step by step, moving towards writing more professional Python code 🚀 #Python #Programming #Coding #LearningJourney #Beginner #TechSkills
To view or add a comment, sign in
-
-
🐍 Day 26 of My 30-Day Python Learning Challenge 🚀 Today I enhanced my Log File Analyzer Project by adding a new feature. 📌 New Feature: Top N Words (User Choice) Instead of showing only top 3 words, users can now choose how many top words they want. 📌 Code: top_n = int(input("Enter number of top words: ")) top_words = sorted(word_count.items(), key=lambda x: x[1], reverse=True)[:top_n] print(top_words) --- 📊 What Changed? • Before → Fixed output (Top 3 words) • Now → Dynamic output (User-defined) --- 💡 Why this matters? • Makes the project flexible • Improves user experience • Closer to real-world applications --- 📊 Quick Question What will happen if user enters a very large number? A) Error B) Full list is returned C) Empty output D) Program stops Answer tomorrow 👇 #Python #MiniProject #ProjectEnhancement #LearningInPublic #SoftwareDeveloper
To view or add a comment, sign in
-
Recursion confused me. So I built a visualizer for it. 🐍 Most beginners (including me) struggle with one thing: "What actually happens when a function calls itself?" So I wrote a Python program that shows you — step by step, with a delay so you can actually follow it. Watch it go DOWN the stack, hit the base case, then come back UP — adding numbers on the way. 👇 What I used: → Recursion — function calling itself → time.sleep() — to slow execution down visually → Print statements — to trace every step This isn't from a tutorial. I built this because I was confused. That's the best reason to build anything. 💡 Important: Dry run your code, It helps alot. #Python #Recursion #LearningInPublic #DataAnalytics #BBA #BuildInPublic
To view or add a comment, sign in
-
Day 3 — DSA with Python Solved Group Anagrams today. Yesterday was about understanding what makes two words anagrams. Today was about applying that concept at scale. Key Insight: Sorting transforms all anagrams into the same representation. "eat" → "aet" "tea" → "aet" "ate" → "aet" Same sorted key → same group. A simple hash map does the job efficiently. What stood out today: DSA isn’t about isolated problems. It’s a chain. Concepts compound. Yesterday’s understanding becomes today’s solution. That’s when learning shifts from memorizing to thinking. On to Day 4. #DSA #Python #100DaysOfCode #PlacementPrep #LearningInPublic
To view or add a comment, sign in
-
Explore related topics
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