V
15

Stumbled into building my first working calculator script in Python today

I was just messing around with a tutorial online and decided to add my own twist by making the calculator handle division by zero. To my surprise, it actually worked after fixing a typo where I forgot a colon. I typed 10/0 and it returned 'Error: cannot divide by zero' instead of crashing. Took me about 45 minutes to get it right with the if-else logic. Has anyone else hit a small win like this that felt way bigger than it should have?
3 comments

Log in to join the discussion

Log In
3 Comments
nancy_king29
My coffee maker broke last week and I spent two hours trying to fix it with YouTube videos before just buying a new one for 30 bucks. Funny how I'll wrestle with a calculator script for 45 minutes over something simple but give up on a household fix after fifteen. It's like the smaller the task, the bigger the victory feels when you actually conquer it. I keep a little note on my phone of these tiny wins now, just to remind myself I can still learn stuff.
4
erickelly
erickelly1d ago
Man that's awesome, man. Same thing happened to me when I built a password generator. I spent a whole evening debugging a loop that wouldn't stop and when I finally found the missing equals sign I almost yelled out loud. My advice is to write down exactly what you did step by step. Not the code itself but the logic behind it. Like "if denominator equals zero then print error instead of crashing." That way next time you need to handle an edge case you can just look at your notes and remember the pattern. The little wins add up way faster than you think. Just keep a text file or a notebook for the small stuff.
2
sammartinez
The little note idea is interesting, but what kind of things do you actually put on it? I find that when I make a list of small wins, I end up just writing down obvious stuff like "made the bed" or "remembered to pay the water bill." Those don't really give me the same boost as figuring out a stubborn piece of code or fixing something on my car myself. It sounds like your list has actual technical achievements on it, not just daily chores.
1