Seksjon 4. Kapittel 3
single
Challenge: The Digital Tea Kettle
Sveip for å vise menyen
Oppgave
Sveip for å begynne å kode
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
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 4. Kapittel 3
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår