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

single

Challenge: The Digital Tea Kettle

Glissez pour afficher le menu

Tâche

Glissez pour commencer à coder

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 desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 4. Chapitre 3
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

some-alt