Challenge: Coroutine to Compute Running Maximum
Create a coroutine to compute the maximum.
We'll cover the following
Problem statement
Design a coroutine maximum
that computes the result
, i.e., the maximum of the values passed across invocations. In other words, create a coroutine in such a way that it keeps on accepting the values and finds the maximum among them as long as the caller sends them. The maximum
will only terminate when the caller calls .close()
on it.
🤔 Note: Assume that all the values are integers. There’s no need to handle non-integral values.
Get hands-on with 1400+ tech skills courses.