Day 5 of my Python learning journey — diving deeper into OOP Today I implemented two core classes: BankAccount and InventoryItem, with a focus on clean design and proper encapsulation. A key takeaway: Validate first, then modify state — never the other way around. I also caught a few common pitfalls early: • Exposing internal attributes directly • Performing validation after state changes • Duplicating logic across methods This exercise reinforced an important principle: a well-designed class should be self-protecting. External code should interact with it safely through defined interfaces, without risking inconsistent state. Feeling more confident with structuring real-world logic using classes and applying these concepts in API design with FastAPI. GitHub Repository: https://lnkd.in/dqBZtfpM #Python #OOP #FastAPI #SoftwareEngineering #CleanCode #LearningInPublic
Implementing OOP in Python with BankAccount and InventoryItem Classes
More Relevant Posts
-
The moment you add a new condition to an if/else chain in your pipeline, you’ve modified existing code! That’s exactly the smell OCP is meant to catch. 🔍 Open for extension, closed for modification means adding new behavior by writing new code, not patching old one! In my latest article, I break down what OCP looks like in Python data projects: strategy patterns, abstract base classes, and the tradeoffs of when the extra structure is actually worth it. https://lnkd.in/eE9yicvC This is Part 2 of my SOLID series. What’s the most painful “just add another elif” you’ve ever had to maintain? 😅 #Python #SoftwareEngineering #SOLID #DataScience #CleanCode
To view or add a comment, sign in
-
🚀 Day 24 of My Python Learning Journey – Constructors & Access Specifiers Today I learned about Constructors in Python (__init__) and how objects are initialized. 🔹 Key Learnings: __init__() is a special method automatically called when an object is created Used to initialize attributes inside a class 🔐 Access Types in Python: Public → Accessible anywhere Protected (_var) → Convention-based usage Private (__var) → Name mangling for restricted access 💡 Practiced multiple examples to understand how objects store and manage data in real-world scenarios. 📂 GitHub Repository (My Daily Practice Code): 👉 https://lnkd.in/giyEbqTH 📌 Consistency is helping me build a strong foundation in OOP. #Python #OOP #100DaysOfCode #GitHub #CodingJourney #Learning #codegnan
To view or add a comment, sign in
-
-
⏰ Day 56 of My Python Journey – Building an Alarm Clock Today I combined my knowledge of date & time manipulation with automation and text-to-speech to create a simple alarm program in Python. 🔹 What I built: An alarm that checks the current time continuously using the datetime module. When the set alarm time matches, it triggers a voice alert using the pyttsx3 library. Added a loop to repeat the spoken message multiple times for emphasis. 🔹 Key Learnings: How to integrate multiple modules (datetime, time, pyttsx3) to solve a real-world problem. The importance of continuous loops and condition checks in automation tasks. How text-to-speech can make Python programs more interactive and user-friendly. ✨ Reflection: Crossing Day 56 feels exciting because I’m now building programs that connect directly to everyday life. From simple algorithms to now creating an alarm clock, Python is proving to be a versatile tool for both problem-solving and practical applications. #Python #Day56 #LearningJourney #Automation #TextToSpeech #CodingConsistency #ProblemSolving
To view or add a comment, sign in
-
Built a simple File Reader CLI in Python today. This project takes a file path as input, opens the file, reads its contents, and prints everything directly in the terminal. What I learned while building it: • Taking user input with input() • Opening files using open() • Reading file content with read() • Using with for safe file handling • Adding error handling with try/except Small projects like this are helping me strengthen my Python fundamentals and get more comfortable with writing clean, practical code. GitHub Repository: https://lnkd.in/gud495tr #Python #PythonProjects #CLI #CodingJourney #Programming #LearningInPublic
To view or add a comment, sign in
-
🔁 Python Revision – Sets Continuing my Python fundamentals revision 🐍 In this session, I focused on: ✔️ Sets (creation and properties) ✔️ Unique elements and unordered nature ✔️ Set methods (add, remove, discard, etc.) ✔️ Set operations (union, intersection, difference) Practiced using sets to handle unique data and perform efficient operations like finding common or different elements between datasets. Documented my practice in a Jupyter Notebook and shared it as a PDF to track my progress. Understanding sets is helping me work better with data and avoid duplicates 📊 Next: dictionaries and real-world data handling 🚀 #Python #Revision #Sets #Programming #DataAnalytics #LearningJourney #Coding
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
-
#python #EP 1 Mastering Python Variables & Scope I’ve put together a beginner-friendly tutorial that covers everything we and I need to know about variables in Python — from naming rules and assignments to dynamic typing, object references, and the #LEGB scope resolution. 🔑 Key highlights in the tutorial: ✅ Rules for naming variables (valid vs invalid examples) 🎯 Assigning values & dynamic typing 📦 Multiple assignments in one line 🧩 Object references & how Python handles memory 🔍 Type checking & casting 🗑️ Deleting variables safely ⚡ Practical examples (swapping, counting characters) 🔑 Scope explained with the #LEGB rule (Local, Enclosing, Global, Built-in) 👉 Check out the full tutorial here: Python Variables & Scope – GitHub Repo git repo https://lnkd.in/g5vHi52w
To view or add a comment, sign in
-
-
🚀 Day 18 – Flatten a Nested List (Python) 💻 Today’s task: Write a function to flatten a nested list. 🔍 A nested list contains elements that can be lists within lists. The goal is to convert it into a single, flat list. 📌 This exercise helped me understand: • Recursion concepts 🔁 • List traversal techniques 🧩 • Writing flexible and reusable functions ⚙️ ✨ A great problem to improve logical thinking and handle complex data structures. 📈 Learning step by step and staying consistent. #Python #100DaysOfCode #CodingJourney #Programming #ProblemSolving #Developer #LearnToCode #Tech #PythonTips #DataStructures
To view or add a comment, sign in
-
Day 2 of my Python Full Stack journey. ✅ Today I covered the very first building block of Python: → Variables → Data Types (int, float, str, bool) → f-strings to print dynamic output Looks simple. But this is the foundation everything else is built on. Here's what I actually typed today: name = "Punith" # str age = 24. # int score = 9.5 # float is_dev = True # bool print("Hi, I'm {Punith}, age {24}") and many. One thing that clicked today: Python figures out the data type automatically. No need to declare it like in Java or C. This is called dynamic typing — and it makes Python so much cleaner to write. 45 minutes. Committed to GitHub. Showing up again tomorrow. If you're learning to code right now — what was the first concept that actually made sense to you? #PythonFullStack #Day2 #BuildingInPublic #100DaysOfCode #Bangalore
To view or add a comment, sign in
-
-
🚀 Learning Python the Practical Way: Understanding Virtual Environments Over the past few days, I started learning Python and decided to focus on building instead of just reading syntax. Today, I explored one of the most important concepts for any developer: Virtual Environments (venv) Here’s what I understood: 🔹 A virtual environment is an isolated Python setup for a specific project 🔹 It prevents version conflicts between different projects 🔹 Each project can have its own dependencies without affecting others 💡 Why it matters: While working on multiple projects, different versions of the same library can break things. Virtual environments solve this by keeping everything separate and controlled. 🛠️ What I practiced: Creating a virtual environment Activating and deactivating it Installing packages inside it Understanding how Python uses project-specific paths This concept is very similar to how we manage dependencies in Node.js projects, but implemented differently in Python. Next step: Building a simple backend server using FastAPI to apply this knowledge in real projects. #Python #BackendDevelopment #FastAPI #WebDevelopment #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