You are browsing as a guest. Sign up (or log in) to start making projects!

16m 44s logged

python calculator devlog

built a terminal calculator in python today. nothing really big. i did this for the sticker :pf: :heavysob:

the main thing i wanted was a clean menu system so i used a numbered list and sys.exit() to handle the exit case gracefully. sys.exit() was the cool thing i found that makes the code exit without all these error messages in the terminal. additionally, also added input validation so if you pick a choice outside 1-5 it tells you instead of just crashing.

one fun thing: added ascii art at the start and end using multiline print statements. the banner at the top took a while to get right because the spacing kept breaking.

also handled division by zero explicitly since thats a pretty common edge case that trips people up.

next steps: maybe add a loop so you can do multiple calculations without rerunning the script

0
7

Comments 0

No comments yet. Be the first!