Numeric data types

Data Types in Python

Jason Myers

Instructor

Built in numeric types

Integer

  • Whole numbers
  • Large values
int(123456789123456789)
123456789123456789

Float

  • Fractional amounts (approximation)
  • Scientific notation
float(123456789123456789)
1.2345678912345678e+17
Data Types in Python

Decimals

  • Exact precision
  • Currency operations
from decimal import Decimal
Decimal('123456789123456789')
Decimal('123456789123456789')
Data Types in Python

Printing floats

print(0.00001)
1e-05
print(f"{0.00001:f}")
0.000010
Data Types in Python

Printing floats

print(f"{0.0000001:f}")
0.000000
print(f"{0.0000001:.7f}")
0.0000001
Data Types in Python

Python division types

4/2
2.0
4//2
2
7//3
2
Data Types in Python

Let's practice!

Data Types in Python

Preparing Video For Download...