I am typing code that checks if the number is positive, negative and if it has decimals or not. Is there a quicker way to check for decimals?
n = input("Type a number: ")
try:
n = int(n)
if n > 0:
print("n is positive")
elif n < 0:
print("n is negative")
else:
print("n is zero")
except ValueError:
n = float(n)
if n > 0:
print("n is positive and decimal")
elif n < 0:
print("n is negative and decimal")
else:
print("n is zero")
print(n)
input()