Name

float

Examples
# Declare variable 'a' and assign it the value 1.5387
a = 1.5387 

# Declare variable 'b' and assign it the value -2.984
b = -2.984 

# Declare variable 'c' and assign it the sum of 'a' and 'b'
c = a + b  
f = 0
for i in range(100000):
    f = f + 0.0001  # Bad idea! See below.

for i in range(100000):
    # The variable 'f' will work better here,
    # less affected by rounding
    # Count by thousandths
    f = i / 1000.0  
Description
Syntax
var = value
Parameters
var
value
Related int
Updated on Wed Jan 18 17:32:21 2017.
Creative Commons License