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.
5 Answers
Nice work! If you're up for a challenge, why not try adding multiplication to your calculator? It could be a fun addition!
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.
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!
Cool project! Also, have you considered using floats instead of integers? That way, users can input decimal numbers, which is super useful for calculations!
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?

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically