7. Numeric variables¶
Integers do not have decimal places:
42
,-7
Values of type integer in Python are called
int
Floating point numbers have decimal places:
1.0
,3.1415
,1234.56
Note that
1.0
, even though it has a zero in the decimal part, is a floating point numberValues of type floating point in Python are called
float
.
7.1. Representation of numeric values¶
Internally, all numbers are represented with the binary system
This system only allows the digits
0
or1
Floating point numbers may not have a proper representation in the binary system
Typing in the interpreter
3 * 0.1
will give us a response of:0.30000000000000004
Try it here!
You have attempted of activities on this page