Hint: You can adjust the default video playback speed in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

What Are Python Coroutines?

Give Feedback

This lesson and the subsequent ones introduce Python coroutines and the benefits of running things asynchronously. You’ll learn what they are and how they compare to generators.

In this video, you’ll also see how to create a synchronous function that prints out a random number after a few seconds.

def randn():
    time.sleep(3)
    return randint(1, 10)

Comments & Discussion

UBBA on May 16, 2019

Note that iPython is now Jupyter. %time will work in Jupyter which can be run right inside Visual Studio Code(Run python in interactive window).

Become a Member to join the conversation.