Examples of valid numbers: 123, 43.76, 89, 100000, 78765.987 (5 examples of valid number are given here, but there are infinitly many valid numbers)
Examples of strings (invalid numbers): 123abc, 7.9.8, afadf, *&^dadsf (4 string examples given here, but there are infinitly many such values which are not valid numbers)
How can I write a program that can tell the difference of a valid or non valid number
However my code is not working , this is the approach I came up with but if anybody can let me know of a better one that would be amazing , peace and good night on the eastcoast
#x = 8dhsdkjha and y = 88 output: both are valid numbers
which is false
x = input(":")
y = input(":")
if type(y) and type(x) == int or float:
print('both are valid numbers')
elif (type(y) == int and type(x)) == str or (type(x) == str and type(y)== int):
print('one of the values is a valid number ')
else: print('none are valid numbers')