Python Calculator

sammyGH
by sammyGH · 4 posts
3 years ago in Python
Posted 3 years ago · Author
Heres some code I wrote for a calculator in Python.


Code
num1 = float(input("Enter first number: ")) operator = input("Enter operator: ") num2 = float(input("Enter second number: ")) 
 
if operator == "+":     print(num1 + num2) elif operator == "-":     print(num1 - num2)
elif operator == "/":     print(num1 / num2) elif operator == "*":     print(num1 * num2) else:     print("Error: Invalid operator."
Posted 3 years ago

@sammy1
:please: ooh i love seeing new posts in this section. Thank you for sharing :awesome18:

Posted 3 years ago · Author
you're wlecome!
Posted 3 years ago
Nice add Sammy. I agree with Soli. Its always nice to see new post esp when we can try them out :) Thanks for sharing :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here

SIGN IN NOW

Create an account

Sign up for a new account in our community. It's easy!

REGISTER A NEW ACCOUNT