Numerische Datentypen

Datentypen in Python

Jason Myers

Instructor

Eingebaute numerische Typen

Integer

  • Ganze Zahlen
  • Große Werte
int(123456789123456789)
123456789123456789

Float

  • Bruchteile (Annäherung)
  • Wissenschaftliche Notation
float(123456789123456789)
1.2345678912345678e+17
Datentypen in Python

Dezimalzahlen

  • Exakte Präzision
  • Währungsberechnungen
from decimal import Decimal
Decimal('123456789123456789')
Decimal('123456789123456789')
Datentypen in Python

Floats ausgeben

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

Floats ausgeben

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

Divisionstypen in Python

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

Lass uns üben!

Datentypen in Python

Preparing Video For Download...