Section 4. Chapter 3
single
Challenge: The Digital Tea Kettle
Swipe to show menu
Task
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.
Solution
Everything was clear?
Thanks for your feedback!
Section 4. Chapter 3
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat