Numeric Data Types
Numeric data types are used to represent numbers and perform mathematical operations in your programs.
Integers
An integer is a data type used to represent whole numbers without any fractional or decimal parts. Integers can be positive, negative, or zero. They are used for a wide range of purposes, including counting, indexing, and performing mathematical calculations. For example
age = 25
Floats
A float, short for “floating-point number,” is a data type used to represent real numbers with fractional parts. Floats are used to perform mathematical calculations that involve decimal values. They are commonly used in scientific and mathematical computations, as well as in applications that require precision and accuracy in representing ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access