Drop links or images here to add them to the editor.
Variabelen
score = 10 # waarde toekennen
score = score + 1 # waarde veranderen
print(score)
Verkorte operatoren
n += 5 # n = n + 5
n -= 3 # n = n - 3
n *= 2 # n = n * 2
n /= 4 # n = n / 4
Standaardfuncties
max(3, 10, -2) # grootste: 10
min(3, 10, -2) # kleinste: -2
pow(2, 3) # 2³ = 8
round(3.65, 1) # 3.7
abs(-8) # 8
len("informatica") # 11
Willekeurig getal
import random
random.randint(1, 6) # geheel getal 1 t/m 6
random.random() # kommagetal 0.0 tot 1.0
Constanten (HOOFDLETTERS)
PI = 3.14
MINIMUMLEEFTIJD = 18