This is a calculator that is capable of calculating two numbers.
On line 3 and 6, I wanted to make python say "Please enter a number: " until the consumer enters a number but somehow even I enter a number, python does not continue the process. Probably because of
while num1 != float:
and
while num2 != float:
.
But I'm not sure how to fix it even if I'm right.
num1 = input("Enter a number: ")
while num1 != float:
input("Please enter a number: ")
num2 = input("Enter a number: ")
while num2 != float:
input("Please enter a number: ")
op = input("What operator would you use?")
if op == "+":
print(float(num1) + float(num2))
elif op == "-":
print(float(num1) - float(num2))
elif op == "*":
print(float(num1) * float(num2))
elif op == "/":
print(float(num1) / float(num2))
else:
print("Invalid operator")