Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Float

Floating point numbers, or floats, in python is anything that has a decimal. Most of the time, types will "upgrade" to float if doing anything where that data is important

print(1.1 + 2.2)   # => 3.3
print(10.0 / 3)    # => 3.33333333333
print(10 / 3.0)    # => 3.33333333333    note: float division will always return a float
print(10 / 3)      # => 3.33333333333    regardless of what types were used
print(6.6 * 5.4)   # => 35.64

Contributors: