Numerieke datatypen

Datatypen in Python

Jason Myers

Instructor

Ingebouwde numerieke typen

Integer

  • Gehele getallen
  • Grote waarden
int(123456789123456789)
123456789123456789

Float

  • Breuken (benadering)
  • Wetenschappelijke notatie
float(123456789123456789)
1.2345678912345678e+17
Datatypen in Python

Decimals

  • Exacte precisie
  • Valutaberekeningen
from decimal import Decimal
Decimal('123456789123456789')
Decimal('123456789123456789')
Datatypen in Python

Floats afdrukken

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

Floats afdrukken

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

Soorten deling in Python

4/2
2.0
4//2
2
7//3
2
Datatypen in Python

Laten we oefenen!

Datatypen in Python

Preparing Video For Download...