3.6 - Coroutines Basics and Sending Values to Generators
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Practice Questions
Test your understanding with targeted questions
What is a coroutine?
💡 Hint: Think of it as a generator that can do more than just yield.
What keyword is used to pause execution in a coroutine?
💡 Hint: It's also used to send back a value to the caller.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What keyword is used to return a value in a coroutine and pause its execution?
💡 Hint: Think of how generators behave.
Can a coroutine send values back to the caller?
💡 Hint: Consider the names of the methods we discussed.
2 more questions available
Challenge Problems
Push your limits with advanced challenges
Create a coroutine that tracks the average of numbers sent to it. Include features to print the running average each time a new number is added.
💡 Hint: Calculate the average carefully—consider how you can keep track of both sum and count!
Discuss how you might implement a coroutine for real-time data processing in an application like a live chat. What features would it need?
💡 Hint: Think about challenges associated with managing incoming messages and state transitions.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.