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 ...
Get Python Made Easy now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.