Question: what is the difference between yield and return in python?
Answer: return sends a specified value back to its caller, whereas yield can produce a sequence of values. We should use yield when we want to iterate over a sequence but don't want to store the entire sequence in memory. yield is used in Python generators.