Exercise 4: Explore Generators
Explore how to write Python functions that return generators. Learn to produce random weather data with temperature and humidity values using yield. Understand how to control generator stopping conditions based on harsh weather criteria or a maximum number of attempts.
We'll cover the following...
We'll cover the following...
Problem statement
This chapter explains how to write functions that return generators and multiple values. First, consider how to generate the two random values. ...