Day 15/100: Stepping into Intermediate Python - The Coffee Machine Project! Today marks the start of the "Intermediate" phase in my #100DaysOfCode journey. I moved away from simple games to building a functional simulation of a real-world machine. Why Day 15 was different: Instead of just "input/output," I had to manage a System State. The program needs to remember how much water, milk, and coffee is left after every transaction. Key Features I Implemented: Resource Management: Checking if ingredients are sufficient before taking an order. Coin Processing: Calculating totals from Quarters, Dimes, Nickels, and Pennies (precise decimal math!). Transaction Logic: Handling payments, providing change, and updating the machine's "profit" ledger. Report Generation: A special command to see the current status of all resources. I'm now building logic that mirrors how real hardware software works. Onward to Object-Oriented Programming (OOP) tomorrow! Check out my Day 15 code here: https://lnkd.in/gAG6a6qU #Python #VSCode #100DaysOfCode #SystemDesign #SoftwareDevelopment #ProgrammingJourney
Python Coffee Machine Simulation: Resource Management and Transaction Logic
More Relevant Posts
-
🚀 Day 61 of #100DaysOfCode 🧩 Problem: Word Break (LeetCode 139) Today’s problem was all about Dynamic Programming + String Matching. 💡 Problem Statement: Given a string "s" and a dictionary of words "wordDict", determine if "s" can be segmented into a space-separated sequence of one or more dictionary words. --- 🔍 Approach: Instead of checking all possible combinations (which is expensive), I used Dynamic Programming: ✔️ Create a DP array where "dp[i]" means: 👉 Can the substring "s[0:i]" be formed using the dictionary? ✔️ Initialize: "dp[0] = True" (empty string is always valid) ✔️ For every index "i", check all "j < i": If "dp[j]" is True AND "s[j:i]" exists in dictionary → mark "dp[i] = True" --- ⚡ Time Complexity: O(n²) ⚡ Space Complexity: O(n) --- 📌 Key Learning: Dynamic Programming helps avoid recomputation by storing results of subproblems. --- 🔥 Consistency is the real game. #DSA #LeetCode #Python #CodingJourney #PlacementPreparation
To view or add a comment, sign in
-
-
✅ Just solved LeetCode 27 — Remove Element! Small problem. Big lesson. 🧠 The task: remove all occurrences of a value from an array in-place and return the count of remaining elements. No extra array. No shortcuts. Just pointer logic. Here's the two-pointer approach I used: def removeElement(nums, val): k = 0 for i in range(len(nums)): if nums[i] != val: nums[k] = nums[i] k += 1 return k 🔍 The insight: → One pointer (i) scans every element → Another pointer (k) tracks valid write position → Overwrite only what doesn't match val → Result? O(n) time, O(1) space ✨ What's your go-to pattern for in-place array problems? Drop it below 👇 #DSA #LeetCode #CodingInterview #Programming #TwoPointers #Python #SoftwareEngineering #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Mastering the art of loops! 🔄 Discover how loops help your code execute repetitive tasks efficiently. Essentially, loops are like a magical chant that tells your program to keep doing something until a certain condition is met. For developers, mastering loops is crucial for automating tasks and iterating over data structures with ease. Here's the breakdown: 1️⃣ Initialize a counter variable 2️⃣ Set the condition for the loop 3️⃣ Define the action to perform in each iteration Sample code using a "for" loop in Python: ``` for i in range(5): print("Hello, World!") ``` 🌟 Pro Tip: Use loops to reduce redundancy in your code and boost efficiency. 💡 ⚠️ Common Mistake: Forgetting to update the counter variable in the loop, leading to an infinite loop! 🔄 🌟 What's your favorite use case for loops in your projects? Let's discuss! 💬 #Coding101 #LearnToCode #TechTips #CodeNewbie #PythonProgramming #DeveloperCommunity #LoopLogic #CodeEfficiency #ProDevSkills 🌐 View my full portfolio and more dev resources at tharindunipun.lk
To view or add a comment, sign in
-
-
Day 16/100: Transitioning from Logic to Objects! Today was a turning point in my #100DaysOfCode journey. I moved away from "Procedural Programming" and dived deep into Object-Oriented Programming (OOP). What I explored today: Classes vs. Objects: Understanding that a Class is a blueprint (like a house map) and an Object is the actual house. The Turtle Graphics: Using the Turtle class to understand how methods and attributes work in real-time. Abstraction: Learning how to use complex code written by others without needing to know every internal detail. Main Project: Coffee Machine (OOP Version) I rebuilt the Day 15 Coffee Machine project, but this time using OOP. Instead of one long script, I used separate classes for the Menu, CoffeeMaker, and MoneyMachine. This made the code incredibly organized and modular. OOP felt a bit strange at first, but seeing how it simplifies large-scale projects is a game-changer! Check out my OOP-based Coffee Machine here: https://lnkd.in/gAfvCxFy #Python #OOP #ObjectOrientedProgramming #100DaysOfCode #SoftwareArchitecture #VSCode
To view or add a comment, sign in
-
-
24/100: Mastering File Systems & Automation! After building games for the last few days, today I shifted my focus toward File Handling and Automation in Python. This is where coding starts to solve real-world administrative tasks! Key Learnings from Day 24: File I/O: Understanding the difference between read, write, and append modes. The "With" Keyword: Learning how to manage file resources safely using context managers (no more manual .close()!). Mail Merge Project: Built a script that automates personalized letters. It takes a list of names and a template, then generates individual files for each person. Automating repetitive tasks like these is exactly why Python is so powerful in the business world. #Python #100DaysOfCode #Automation #FileHandling #Programming #VSCode
To view or add a comment, sign in
-
Day 5 of my 100 Days of Code challenge! 💻🐍 Today I built a Password Generator in Python along with completing the classic FizzBuzz problem. 🔐 Password Generator A program that creates a secure password based on user input. The user chooses how many letters, numbers, and symbols they want, and the program randomly generates and shuffles them to create a strong password. 🔢 FizzBuzz A classic problem where numbers from 1–100 are printed, but multiples of 3 show “fizz”, multiples of 5 show “buzz”, and multiples of both show “fizzbuzz”. Today’s focus was practicing: • Loops (for loops) • The random module • Lists and list manipulation • The modulo operator % • Building and combining logic step by step Learning in public and documenting my journey into software engineering. Check out the projects here: https://lnkd.in/eCYaEybF #100DaysOfCode #Python #SoftwareEngineering #LearningInPublic #CodingJourney
To view or add a comment, sign in
-
Day 7/10 🚀 This is where your code grows up. Modules & Packages — the foundation of every scalable Python project. Without them? Spaghetti code, repetition, no structure. With them? Clean, reusable, production-ready code. 📋 What I covered today: 01 → Modules & package structure 02 → Creating & importing .py files 03 → init.py & sub-packages 04 → Import styles — import, from, alias 05 → Relative vs absolute imports 06 → Standard library — os, json, datetime, re 07 → Third-party packages — pip, numpy, pandas 08 → Virtual environments & requirements.txt 09 → Mini Project — Config Loader Package Built a small config package with loader & validator modules — a real-world pattern used in production apps. Day 1 ✅ Day 2 ✅ Day 3 ✅ Day 4 ✅ Day 5 ✅ Day 6 ✅ Day 7 ✅ 3 more to go. Drop a 📦 if you’ve ever put everything in one giant .py file 😄 #Python #Modules #Packages #DataEngineering #LearningInPublic #CleanCode #10DaysOfPython #SoftwareEngineering
To view or add a comment, sign in
-
🚀 Day 79 of #100DaysOfCode 💡 LeetCode 338 – Counting Bits Solved today’s problem with a clean and efficient Dynamic Programming + Bit Manipulation approach 💪 🔍 Problem: For a given number "n", return an array where each index "i" contains the number of 1’s in the binary form of "i". ⚡ My Approach: Instead of recalculating bits every time, I reused previous results: 👉 "ans[i] = ans[i >> 1] + (i & 1)" 🧠 Why this works: - "i >> 1" → removes the last bit - "(i & 1)" → checks if last bit is 1 📈 Performance: ✅ Runtime: 3 ms (Beats 95% 🚀) ✅ Memory: 20.14 MB 🔥 Key Learning: Patterns in binary operations can simplify problems drastically. DP + bit tricks = powerful combo ⚡ #Day79 #LeetCode #CodingJourney #Python #DSA #DynamicProgramming #BitManipulation #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Excited to Share My Latest Project: SIP Calculator 💰 I have created a SIP Calculator using Python that helps users estimate their investment growth over time. 📌 Project Features: Calculates total investment value Shows estimated returns Uses compound interest logic Simple and user-friendly input system 🧠 What I Learned: Python functions and logic building Financial concepts like SIP & compound interest Real-world problem solving using programming 💡 This project made me understand how small monthly investments can grow into a large amount over time. 🔗 GitHub: [https://lnkd.in/dgKR3Dnj] #Python #SIPCalculator #Programming #StudentDeveloper #Finance #Coding
To view or add a comment, sign in
-
-
Day 2/30 – Building with Python Recently, I worked on a Vehicle Feedback System using Python The idea behind this project was to create a simple system where users can: 📝 Submit feedback about vehicles 📊 Store and manage responses efficiently Through this project, I learned: ✨ How to handle user input and data ✨ Basic logic building and structuring a program ✨ The importance of user-friendly systems This is just the beginning — I’m planning to improve it further by adding: OTP-based authentication for better security Database integration for scalability Possibly a simple UI for better user experience Building projects like this is helping me understand how real-world systems evolve step by step Would love your suggestions or ideas to improve this further! #Day2 #PythonProject #LearningInPublic #StudentDeveloper #BuildInPublic #TechJourney
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