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

Python Calculator

  • 1 Devlogs
  • 0 Total hours

making a calc in python for a sticker!

Ship #1

# shipped: python calculator

a terminal based calculator with a menu system, input validation and ascii art banners

supports addition subtraction multiplication and division. handles bad input and division by zero without crashing.

[github](https://github.com/sahilchess/python-calculator)

  • 1 devlog
  • 0h
  • 1.00x multiplier
Try project → See source code →
Open comments for this post

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
0
7

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…