how to check if number has decimals python code example
Example 1: how to check whole number in python
x = 1/3 # insert your number here
print(x - int(x) == 0) # True if x is a whole number, False if it has decimals.
Example 2: w=how to tell if decimal in python
i = 100
f = 1.23
print(type(i))
print(type(f))
# <class 'int'>
# <class 'float'>
Example 3: check number of digits after decimal python
from math import floor
float_num = 7456.4597
float_decimal = float_num - floor(float_num)