Maak een game die verloopt volgens onderstaand schema.
Op het scherm verschijnt het volgende:
Welcome to the Angry Goblin Hunt An award-winning game full of adventure and excitement (!)
Type in your name: Stephen
Stephen, do you think you can find the goblin hiding in the kitchen cupboards?
|_||_||_||_||_|
Which cupboard do you think the goblin is in [type in number]: 2
Sorry! The goblin is still lurking somewhere else.
Which cupboard do you think the goblin is in [type in number]: 4
Sorry! The goblin is still lurking somewhere else.
Which cupboard do you think the goblin is in [type in number]: 3
Sorry! The goblin is still lurking somewhere else.
Which cupboard do you think the goblin is in [type in number]: 1
Well done!! You have found the goblin. He was so scared he ran away.
Hier is een samenvatting:
Testen
Achtergrondinformatie
De random module bevat een functie randint(begingetal, eingetal) die een willekeurig integer getal teruggeeft tussen het begingetal en tot en met het eindgetal. De import van de random module gebeurt op de 1ste regel van het programma.
Voorbeeld 1:
import random
willekeurig_getal = random.randint(1, 10)
Of voorbeeld 2:
from random import randint
willekeurig_getal = randint(1, 10)