Sektion 4. Kapitel 3
single
Challenge: The Digital Tea Kettle
Stryg for at vise menuen
Opgave
Swipe to start coding
Create a coroutine that simulates a digital tea kettle boiling water.
- Define a coroutine function called
boil_waterusing theasynckeyword. - Inside the coroutine, print
"Kettle is on...". - Simulate boiling for 3 seconds.
- After the wait, print
"Ding! Water is boiled.".
Your code should produce: Kettle is on... waits for 2 seconds Ding! Water is boiled.
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 4. Kapitel 3
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat