Python program to o Capture String Errors
x = input("Insert numbers only: ")
while type(x) != float:
try:
x = float(x)
except ValueError:
print("Error! Please insert only numbers...")
x = input("Insert numbers only: ")
print(x/2)
Output:
|
Insert numbers only: 123d |