Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: The Digital Tea Kettle | Asynchronous Programming (asyncio)
Python Structural Programming
Section 4. Chapter 3
single

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_water using the async keyword.
  • 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

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 4. Chapter 3
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

some-alt