Drop links or images here to add them to the editor.

Python heeft een aantal handige ingebouwde functies:

# max() — grootste waarde
print(max(3, 5, 4))          # 5

# min() — kleinste waarde
print(min(3, 5, 4))          # 3

# pow() — machtsverheffing
print(pow(2, 4))             # 16  (2 tot de macht 4)

# round() — afronden
print(round(3.14342, 2))     # 3.14

# abs() — absolute waarde (altijd positief)
print(abs(-4.3))             # 4.3

# len() — lengte (aantal tekens/elementen)
print(len("0612345678"))     # 10

Gebruik

Je slaat het resultaat op in een variabele:

grootste = max(3, 10, -2, 7)
print(grootste)    # 10