[Python] Creating Better Calculator !
Last time we made the basic calculator, now we're going to make a better one with if statement.
Let me make these;
num1 = float(input("Enter first number:"))
op = input("Enter operator(+ - / *):")
num2 = float(input("Enter second number:"))
so the user is going to be asked to put the numbers and operator themselves.
and make the operation with if statements here
if op == "+":
print(num1+num2)
elif op == "-":
print(num1-num2)
elif op == "/":
print(num1/num2)
elif op== "*":
print(num1*num2)
else:
print("Invalid")
I made +, -, /, *
you can make more.. whatever you want
and Let's Run
Enter first number: 5.2
Enter operator(+ - / *): *
Enter second number: 55.1
286.52000000000004