Beginner question


hello, I am just a beginner to coding. I just wanted to find out why in the booleans on python. What is the essence of
my_int = 7
does int always have to be a whole number integer and floot a decimal.


Your code consists of three data types, two of them numbers. An int is always a whole number. Integers are numbers on the number line from negative infinity to positive infinity that are whole numbers. Floats are numbers that are not evenly divisible by 1. There is a decimal point in the base 10 value representation.

def is_int(x):
    return not (x % 1)

def is_float(x):
    return not not (x % 1)

def is_bool(x):
    return str(x) in 'TrueFalse'


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.