Looking for Feedback on My First Python Project: A Simple Calculator

November 17, 2025 5 answers
Asked by +StencilWork
Hey everyone! I'm 15 years old and I've just started learning Python. For my first real project, I created a simple calculator program. Here's the code I wrote: ```python num1 = int(input("Choose a number: ")) num2 = int(input("Choose another number: ")) # selecting the numbers operator = int(input("Choose an operator (1=+; 2=-; 3=/): ")) if operator == 1: result = num1 + num2 elif operator == 2: result = num1 - num2 elif operator == 3: result = num1 / num2 print("Here is your result:", result) ``` I'm here to get some advice on this program and also looking to learn more about Python in general. If anyone has similar projects, I'd love to hear about those too! Thanks for taking the time to read this.

Answers

shelf-stable-soup
Congrats on your first project! Just a tip, consider formatting your code using markdown next time; it makes it a lot easier for others to read. Have you thought about what happens if the user inputs a letter instead of a number? Or what if they choose an operation that's not listed? And donโ€™t forget to check for division by zero! Also, what's the largest and smallest number your calculator can handle?
Reply to this answer
406 kiln shelf
Cool project! Also, have you considered using floats instead of integers? That way, users can input decimal numbers, which is super useful for calculations!
Reply to this answer
beyond.the.semilattice
This is awesome! Remember, programming is all about solving problems. Focus on improving your code and fixing any bugs you find. You'll learn a lot that way! Keep it up!
Reply to this answer
~folio48
Great start! You should check out Python's `eval` function; it might be a neat way to simplify your calculator logic and handle expressions more dynamically.
Reply to this answer
WickerBasket
Nice work! If you're up for a challenge, why not try adding multiplication to your calculator? It could be a fun addition!
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions