7. Numeric variables¶
Integers do not have decimal places:
42,-7Values of type integer in Python are called
intFloating point numbers have decimal places:
1.0,3.1415,1234.56Note 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
0or1Floating point numbers may not have a proper representation in the binary system
Typing in the interpreter
3 * 0.1will give us a response of:0.30000000000000004
Try it here!
You have attempted of activities on this page
