Learning namespaces and decorators in Python today, and it changed the way I think about how Python organizes code. Namespaces helped me understand how Python keeps variables and functions separated to avoid conflicts. The LEGB rule (Local → Enclosing → Global → Built-in) made it much clearer how Python decides where to look for a variable. Then I explored decorators. At first they looked confusing, but they’re actually a powerful way to modify the behavior of a function without changing the function itself. For example, adding logging, timing execution, or access control becomes much cleaner with decorators. Small concepts like these make Python feel much more elegant once they click. Currently focusing on improving my fundamentals in Python and machine learning, one concept at a time. #Python #Programming #LearningInPublic #100DaysOfCode #MachineLearning
Mastering Python Namespaces and Decorators for Elegant Code
More Relevant Posts
-
🐍 Day 5 of My 30-Day Python Learning Challenge Today I learned about Loops in Python — a powerful way to repeat tasks without writing the same code again. 📌 Types of Loops • for loop – used when the number of iterations is known • while loop – runs until a condition becomes false 📌 Example: for loop for i in range(5): print(i) Output: 0 1 2 3 4 📌 Example: while loop count = 1 while count <= 5: print(count) count += 1 Loops are widely used in automation, data processing, and algorithms. 📊 Quick Question What will be the output? for i in range(1,5): print(i) Answer tomorrow in comments. #Python #CodingJourney #Programming #LearningInPublic #SoftwareDeveloper
To view or add a comment, sign in
-
Python Learning Journey – Day 8 🚀 Today’s focus was on string manipulation in Python, which is an essential part of handling real-world data. I practised different operations to understand how strings can be processed and transformed efficiently. Here’s what I worked on: • Extracting characters at even indices • Replacing spaces with underscores • Checking if a string contains only digits • Reversing a string using slicing • Capitalizing the first letter of each word These exercises helped me improve my understanding of string handling, indexing, and built-in Python methods. These exercises helped me build consistency and strengthen fundamentals step by step. Big thanks to VASU KUMAR PALANI and PythonLife for the continuous guidance and support. #Python #CodingJourney #LearnInPublic #PythonStrings #Programming #Consistency #TechSkills
To view or add a comment, sign in
-
-
Python Clarity Series – Episode 20 Topic: set() vs list() for Removing Duplicates 📌 Removing duplicates in Python — quick trick students love. Example list: nums = [1,2,2,3,4,4,5] Using set: unique = list(set(nums)) print(unique) Output: [1,2,3,4,5] 👉 set() automatically removes duplicates. But there is a catch. ⚠️ Sets do not preserve order. Example result might be: [2,1,4,3,5] 💡 Rule: set() → fast duplicate removal list → maintains order Knowing when to use each matters in real programming. #PythonConcepts #CodingTips #StudentDevelopers
To view or add a comment, sign in
-
-
Strings are everywhere in Python - file names, user input, APIs, data cleaning, logs. If you work with Python, these 10 string methods aren’t optional — they’re daily tools. You’ll use them for: - cleaning extra spaces. - checking file extensions. - splitting and joining data. - finding and counting characters. These methods help you write cleaner, shorter, and more readable code. If you ever forget the syntax, this one image is enough to refresh your memory. 📌 Save it — future you will thank you. #Python #LearnPython #PythonTips #Programming #Coding #SoftwareEngineering #PythonDeveloper
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
-
-
🚀 Day 8 of My Python Learning Journey Today, I built a Menu-Driven Calculator Program in Python 🧮 💡 What I learned & implemented: Creating functions (def) for reusable code Performing operations like Addition, Subtraction, Multiplication, Division, and Average Using conditional statements to control program flow Taking user input for dynamic calculations 🧠 Mini Project: Calculator Program I designed a calculator that allows users to: ✔ Select an operation from a menu ✔ Input numbers ✔ Get results instantly 📌 Functions Created: add() → Addition sub() → Subtraction multiply() → Multiplication (and more...) 🔍 Key Learning: Breaking a problem into smaller functions makes the code cleaner, reusable, and easier to manage. 💭 This is helping me build a strong foundation for writing scalable and structured programs. 🚀 Next Step: Loops & Advanced Logic Implementation https://lnkd.in/gJrKBVi3 #Python #LearningJourney #100DaysOfCode #Coding #DataAnalytics #Functions #ProblemSolving
To view or add a comment, sign in
-
My Python Journey: Lists + Loops Today, I focused on building a strong foundation in Python with lists and loops. I practiced 10 essential problems, including: 🔹Printing all elements of a list 🔹Accessing elements at even indices 🔹Filtering even numbers 🔹Finding numbers greater than a threshold 🔹Calculating the sum of all elements (without sum()) 🔹Counting total elements (without len()) 🔹Counting numbers greater than 5 🔹Finding the smallest number (without min()) 🔹Printing a list in reverse (using loops) 🔹Creating a new list with squares of numbers 💡 Key takeaways: Loops are powerful for iteration and data manipulation Conditional checks inside loops make Python very flexible Practicing manually (without built-ins) strengthens problem-solving skills. Here’s a glimpse of my list of numbers I practiced on: nums = [14, 13, 27, 34, 20, 16, 23, 82, 49, 83] Feeling confident and ready for Day 2 challenges! 🔥 #Python #DataAnalytics #CodingJourney #100DaysOfCode #LearningByDoing #ProblemSolving
To view or add a comment, sign in
-
-
Day 74 of #100DaysOfCode: Python Generators! Generators allow lazy evaluation - yielding values one at a time instead of storing everything in memory. This makes them perfect for handling large datasets efficiently! Two key ways to create generators: • Generator functions using 'yield' keyword - they remember their state between calls. • Generator expressions with concise syntax: (x**2 for x in range(5)) - similar to list comprehensions but with parentheses. GitHub: https://lnkd.in/gVAVzQwH #Python #Coding #100DaysOfCode #Programming #LearnToCode #DevCommunity #Tech
To view or add a comment, sign in
-
-
🎮 Rock Paper Scissors – Python Another step forward in my Python learning journey. This time I built a Rock Paper Scissors game in Python where the user plays against the computer in the terminal. The game keeps track of the score, validates user input, and allows the player to continue playing multiple rounds. I also focused on making the interaction smoother by guiding the user whenever an invalid input is entered. 🧠 Concepts practiced in this project: • Python lists • Conditional logic • While loops • Random module • Input validation and user interaction 🎮 Try the game: 🔗 Live Demo (Replit): https://lnkd.in/gwJ6C9tP 💻 GitHub Repository: https://lnkd.in/gjkJwvEX Always learning, one small program at a time. 💻 #Python #CodingJourney #LearningToCode #BeginnerProgrammer #100DaysOfCode
To view or add a comment, sign in
-
Built my first Python mini-project! Over the past few days, I’ve been consistently learning Python fundamentals and applying them through small projects. I recently built a Number Guessing Game where the program generates a random number and the user tries to guess it within limited attempts. While building it, I practiced concepts like: • Functions • Conditional logic • Loops • Exception handling (try–except) • Improving program robustness I also created an improved version that handles invalid input and allows the user to play again. This is just the beginning of my journey as I continue learning Python, problem solving, and eventually AI/ML. You can check out the project here: [https://lnkd.in/gx4NtndT] Looking forward to building more projects and improving step by step. #Python #Programming #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