Day 3 of my #100DaysOfCode challenge is complete! 🚀 Day 3 was all about Control Flow and Logical Operators in Python. Writing clean, efficient logic is absolutely essential for filtering and categorizing datasets, so mastering the foundations of if, elif, and else statements is a massive step forward. Here is a breakdown of what I tackled today: ✔️Conditional Statements: Building decision-making logic into code using if, elif, and else. ✔️ Comparison Operators: Teaching Python how to evaluate data using >, <, >=, <=, ==, and !=. ✔️ Logical Operators: Combining multiple conditions using and, or, and not. ✔️ The Modulo Operator (%): Grabbing the remainder of a division, super helpful for identifying even/odd numbers. ✔️Code Blocks & Scope: Understanding indentation rules in Python. To test my logic, I built a "Python Pizza Delivery" program. It calculates a user's final bill based on their size preference and checks for extra toppings using nested conditional statements. Check my code in the comments section #100DaysOfCode
Mastering Control Flow in Python with Conditional Statements
More Relevant Posts
-
Day 3 of my #100DaysOfCode challenge is complete! 🚀 Day 3 was all about Control Flow and Logical Operators in Python. Writing clean, efficient logic is absolutely essential for filtering and categorizing datasets, so mastering the foundations of if, elif, and else statements is a massive step forward. Here is a breakdown of what I tackled today: ✔️Conditional Statements: Building decision-making logic into code using if, elif, and else. ✔️ Comparison Operators: Teaching Python how to evaluate data using >, <, >=, <=, ==, and !=. ✔️ Logical Operators: Combining multiple conditions using and, or, and not. ✔️ The Modulo Operator (%): Grabbing the remainder of a division, super helpful for identifying even/odd numbers. ✔️Code Blocks & Scope: Understanding indentation rules in Python. To test my logic, I built a "Python Pizza Delivery" program. It calculates a user's final bill based on their size preference and checks for extra toppings using nested conditional statements. Check my code in the comments section #100DaysOfCode
To view or add a comment, sign in
-
If your Python classes feel messy… inheritance is probably the reason. Day 13 of showing up. Topic: Inheritance Built a base `Car` class → extended it into a `SportsCar` with speed + custom display. Simple structure. Deeper lesson. What stood out: • `super()` keeps your code DRY without breaking structure • Overriding methods gives control without rewriting everything • Inheritance isn’t hierarchy — it’s intentional design I initially broke things by skipping `super()`. Attributes didn’t initialize properly. Output felt random. Then it clicked: You’re not just adding features in a child class — you’re building on a contract defined by the parent. That’s where clean code starts. 13 days in. Still focused on fundamentals over shortcuts. What’s one concept that took you longer than expected to fully understand?
To view or add a comment, sign in
-
-
Working on one of my weak areas loops. When I was learning Python earlier, loops were something I never really liked. I used them, but never truly understood how they actually work. Mostly just wrote them without thinking much about the logic or execution. This time, I’m trying a different approach. Instead of just using loops, I’m going deeper understanding how the execution flow works, how conditions are checked, and how each iteration actually runs step by step. Also realized how important loops are. Almost everything in programming involves repetition and automation in some form, and loops are the core behind that. So for the next few days, focusing more on this and trying to get comfortable with it properly.
To view or add a comment, sign in
-
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
-
I’ve put together a quick reference guide covering essential Python Dictionary and Set methods! 🐍 Whether you are just starting out with Python or need a quick refresher, this document walks through everything from basic dictionary operations like .get() and .update(), to mathematical set operations like .intersection() and .symmetric_difference(). It includes brief explanations and simple code snippets for each method to help you write cleaner, more efficient code. Check out the document below, and let me know your favorite or most-used method in the comments! 👇 #Python #Programming #Coding #DataStructures #PythonDeveloper #Cheatsheet
To view or add a comment, sign in
-
🔤 DAY 2/30: I CAN NOW MANIPULATE TEXT LIKE A PRO Today I learned string methods in Python - functions that transform text. 📚 WHAT I LEARNED: • .strip() - remove extra spaces (clean user input) • .upper() / .lower() - change case instantly • String slicing - grab specific parts of text [start:end] • .replace() - swap words in seconds 🛠️ PROJECT: Username Validator A program that: 1. Takes any messy username input 2. Cleans it (removes spaces, fixes case) 3. Validates length (5-15 characters) 4. Tells you if it's available 💡 BIGGEST INSIGHT: String methods don't change the original - they create a NEW string. That's why you need to save them: `name = name.strip()` 🐛 BUG I FIXED: Forgot to save the cleaned string - kept getting original. Now I know: methods RETURN values, they don't modify in place. 📂 DAY 2 CODE: https://lnkd.in/gvg2Rh6N 28 days to go. Getting stronger every day. #Python #30DaysOfCode #CodingJourney #LearnToCode
To view or add a comment, sign in
-
I already had a uv-first setup for Claude Code and Codex. Now I added the Cursor version too. The goal is simple: if a Python project already uses uv, the agent should stay inside that workflow instead of drifting back to pip install, raw python, or manual dependency edits. It sounds like a small detail, but if you use coding agents regularly, these small inconsistencies create a lot of avoidable friction. I wrote a short post about how I extended the same approach to Cursor and kept the workflow consistent across tools: https://lnkd.in/dMZ429Ty
To view or add a comment, sign in
-
-
Day 11/365: Finding the Smallest & Second Smallest Element in a List 🔍📉 Today I worked on a classic list problem in Python: finding the smallest and second smallest elements in a list, along with their indexes — without sorting the list. What this code does step by step: I start with a list L containing different numbers. I initialize two variables: smallest and s_smallest (second smallest) with a value larger than most of the elements in the list. I also track their positions using smallest_index and second_smallest_index. Then I loop through the list using indexes: If the current element is less than or equal to smallest, I: move the current smallest to s_smallest, update smallest with the new value, and update both indexes accordingly. Else if the current element is only smaller than s_smallest, I update just the second smallest and its index. In the end, I print both the smallest and second smallest values with their positions in the list. What I learned from this exercise: How to track not just one, but two minimum values in a single pass through the list. How important it is to maintain both the value and the index while updating. How careful initialization of variables (like smallest and s_smallest) affects the correctness of the logic. How this pattern can be extended to find top-k smallest or largest elements efficiently without sorting. Day 11 done ✅ 354 more to go. If you have ideas like handling edge cases (e.g., duplicates, negative numbers, very large lists) or finding the k-th smallest element, send them my way — I’d love to build on this next. #100DaysOfCode #365DaysOfCode #Python #LogicBuilding #Lists #Indexing #CodingJourney #LearnInPublic #AspiringDeveloper
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
-
Revisiting Python basics this week, I stumbled upon something worth sharing — Name Mangling. We often assume that prefixing a variable with __ (double underscore) makes it truly private. It doesn't. Python internally renames "__key" to "_ClassName__key" — still accessible to anyone who knows the pattern. This becomes a real concern when developers store passwords or API keys thinking they're protected by access specifiers. They're not. Name mangling is designed to avoid accidental attribute clashes in inheritance — not to secure sensitive data. If you're storing secrets in Python, use proper solutions — environment variables, secret vaults, or encrypted storage. Sometimes going back to basics reminds you of the things that really matter. 🐍 #Python #PythonDevelopment #SoftwareEngineering #BackendDevelopment #100DaysOfCode #NameMangling
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
🚀🚀🚀