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

Een functie kan informatie teruggeven aan het hoofdprogramma via return. Die teruggegeven waarde sla je op in een variabele.

import random

### FUNCTIEDEFINITIE
def kiesWillekeurigCompliment():
    willekeurig = random.randint(1, 3)
    if willekeurig == 1:
        gekozen_compliment = "lief"
    elif willekeurig == 2:
        gekozen_compliment = "leuk"
    else:
        gekozen_compliment = "slim"
    return gekozen_compliment

### HOOFDPROGRAMMA
compliment_van_de_dag = kiesWillekeurigCompliment()
print("Jij bent " + compliment_van_de_dag + "!")
print("Klaar")