I'm diving into Python and thought creating a simple calculator would be a fun way to practice. Currently, it can handle basic math operations, but I'm not sure if I'm doing a good job with it. Here's what I've coded so far:
```python
#basic ass calculator lol, it can only perform basic math (as of now)
print("please, enter two numbers below for me to work with them!")
First_number = float(input("First number: "))
Second_number = float(input("Second number: "))
#it allows you to do something other then addition now, yay!
Operation = input("Operation ('+', '-', '*' or 'x', '/'): ")
if Operation == '+':
Result = First_number + Second_number
elif Operation == '-':
Result = First_number - Second_number
elif Operation == '*' or Operation == 'x':
Result = First_number * Second_number
elif Operation == '/':
Result = First_number / Second_number
else:
Result = "that's not an operation bro"
print("Result = " + str(Result))
#this just stops the program from closing the moment the task is completed lol
input("press enter to quit. (you can write something if you want before quitting lol)")
```
I'd love your feedback on whether this is a solid start!
5 Answers
Haha, love the 'banana' easter egg! But remember to check for division by zero! If someone enters 0 as the second number, it could crash your program. Everything else looks solid for a beginner’s project!
Good start! Just a tip: type checkers like Pyright or Mypy would flag your mixed types in the `Result` variable. It's best to keep one consistent type to avoid confusion later on.
Great start! Just a couple of things: make sure to use snake_case for your variable names, like `first_number` instead of `First_number`. Also, your program could crash if someone inputs something that's not a number, so you might want to add error handling for that. Keeping the program open for multiple calculations would also be a nice touch; consider using loops for that.
Totally agree with the snake_case suggestion! It’s especially important in Python since it helps avoid issues in case-sensitive environments. Great point!
Nice work! You could also make your division logic a separate function to clean things up, hiding extra complexity from the main program. It can really help with readability!
You’ve made a good attempt! Instead of focusing on whether it’s 'good,' think about whether it achieves your goals. Have you learned anything? Is it functional? If you feel accomplished with it, then you’ve succeeded!

Yes, definitely handle that division by zero case! It’s a common pitfall, and you want to make sure your calculator can handle even the worst mistakes!