I'm very new to python, just started learning, and wanted to test my skills by building a simple arithmetic calculator. I've tied up most loose ends in my code, but don't know how to provide an error message and new input line to the user when they place a letter/word in the input line for numbers. Again, I'm very new to python and have no idea how to fix this. Also curious about how ugly my code looks. Any advice is appreciated, thanks.
print("Welcome to the Basic Python Calculator!")
def calculator():
num1 = input("Name your first number: ")
num2 = input("Name your second number: ")
operator = input("Name an operation. Add, Subtract, Multiply, or Divide. (Match Capitalization)\n")
while operator != "Add" and operator != "Subtract" and operator != "Multiply" and operator != "Divide":
operator = input("Name an operation. Add, Subtract, Multiply, or Divide. (Match Capitalization)\n")
if operator == "Add":
result = float(num1) + float(num2)
print(num1 + " + " + num2 + " = " + str(result))
elif operator == "Subtract":
result = float(num1) - float(num2)
print(num1 + " - " + num2 + " = " + str(result))
elif operator == "Multiply":
result = float(num1) * float(num2)
print(num1 + " ● " + num2 + " = " + str(result))
elif operator == "Divide":
result = float(num1) / float(num2)
print(num1 + "/" + num2 + " = " + str(result))
calculator()