Introducting Numerical Data Types

int, float, and even complex!

Arithmetic Operators

float result on the left is still equal in value to the int result on the right. 12.0 == 12 is True!

== is the comparison operator for equality testing, asking "are two values equal to each other? True or False?". Just remember one single equals (=) is assignment, giving an identifier a value.

Division

You can convert text containing decimal number parts (digits and period) to a float numerical value. We've done this already using float(input(("Enter a number: ")) pattern.

Floor or Integer Division

Modulus

Exponentiation

Weirdness with Rounding

"Banker's Rounding"

What if we want the value 42? The int function will convert a float value to an int. Note: as shown above, int will not convert a string containing float parts (numbers and period) to an int.