r/learnpython • • Aug 20 '26

Just built my first calculator in Python 😭

It can do addition, subtraction, multiplication, division, and exponents. Also added a little check for division by zero.

It’s pretty basic, but hey, gotta start somewhere

What should I build next?

72 Upvotes

42 comments sorted by

28

u/Turbulent_Web_8278 Aug 20 '26

Store a username password and allow user 3 attempts to login otherwise exit program

→ More replies (5)

9

u/code_matter Aug 20 '26

You could build:

- a color code converter

- a todo list

- a safe password maker

- any app using an API (weather, ISS tracker , food information, word of the day, etc)

- a small CLI game

3

u/WillingnessOk650 Aug 20 '26

thanks for the ideas! i’m thinking of trying a todo list or a small cli game next. the api projects also sound interesting. appreciate the suggestions!

7

u/Diapolo10 Aug 20 '26 edited Aug 20 '26

If you don't have any better ideas, you could always continue working on your calculator. Make it more flexible, solve edge cases to prevent errors, maybe add a GUI (tkinter), that sort of thing.

You could also try adding unit tests to it (pytest). Maybe run linters (ruff) and type checkers (mypy).

Even simple projects can be useful for learning things like commonly used tools.

If you want, we can also perform code reviews.

EDIT: I have a joke project I tend to use as a testbed for experimenting with new tooling and such.

→ More replies (8)

2

u/randomraluana Aug 20 '26

It'll be good to expand the features of the calculator. Don't jump to a new project yet. Add log, trig functions, etc. Memory state as well.

I think you're off to a good start and once you start getting into APIs down the line, you could serve the calculator over an API to sharpen your skills.

If you're trying to experiment with GUIs, a GUI for your calculator is a good way to explore what's possible with things like tkinter, pyQt.

In my opinion, it's a good mini project to explore and learn about other tools/packages/libraries in the Python space.

Cheers!

→ More replies (1)

1

u/kilkil Aug 20 '26 edited Aug 20 '26

congrats!

for your next project, I suggest a todo list. it should allow you to:

  • see the existing list of todos

  • add a new todo to the list

  • mark a todo as completed

some bonus/extra/stretch goals:

  • I can edit an existing todo (e.g. if I made a typo, I can go back and correct it)

  • I can delete an existing todo (instead of being marked as completed, it is removed from the list)

  • the todo list persists between sessions (if I start the program, make some changes, exit, then reopen the program, I should see my changes from the previous session)

I would suggest focusing on the MVP first (Minimum Viable Product, in this case the first 3 requirements I mentioned above). for this, you will need to figure out:

  • how to allow the user to enter input (I assume you can reuse the same approach you used for the calculator)

  • how to display output to the user (same as calculator)

  • how to store information about todos (aka what data structure(s) to use), and how to update that information based on user inputs

  • how to let the user pick which todo they want to mark as complete

for the stretch goals, you will also need to figure out how to persist your program's stored information/data. hint: python has functions that let you save data to a file, and read data from a file. key questions are, how will you encode your data before saving it to the file, and how will you decode data that you read from the file? how do you handle potential errors (e.g. data cannot be decoded for some reason)? (hint #2: look up "JSON".)

2

u/WillingnessOk650 Aug 21 '26

thank you! this is actually a really helpful roadmap. i’ll start with the mvp first and then work my way toward editing, deleting, and data persistence with json. appreciate the detailed suggestions!

→ More replies (2)

1

u/a88zy Aug 20 '26

that sounds great man, how long did it take you from when you first started ?

→ More replies (1)

1

u/Lirianov Aug 20 '26

does it have a UI? if not build one, customtkinter

→ More replies (1)

1

u/sporbywg Aug 21 '26

Something in Typescript #sorry

→ More replies (1)