#user inputs a number
number = input("Enter number: ")
# 1) changes dot and creates a new string,2) verifies is it a number
if(not number.replace(".","").isnumeric()):
print("Sorry number is not numeric")
Generally replace changes old value with a new one.
isnumericreturns True if and only if every character of the string is a numeric character as defined by Unicode. Periods are not numeric, but many characters that contain or represent numbers, such as½or六, are considered numeric.First, you probably want
isdigitinstead, because a lot of the numeric characters in Unicode aren't valid in float numbers.isdigitonly returns True if every character is one of the ASCII digits 0-9.Second, to validate if the input is a float, it's "Better to Ask Forgiveness than Permission": try converting it as a float directly, and see if that fails: