Welcome to Westonci.ca, where your questions are met with accurate answers from a community of experts and enthusiasts. Discover comprehensive solutions to your questions from a wide network of experts on our user-friendly platform. Get precise and detailed answers to your questions from a knowledgeable community of experts on our Q&A platform.

What is the usage of "yield" in python?

Sagot :

Answer:

Yield is a keyword in Python that is used to return from a function without destroying the states of its local variable and when the function is called, the execution starts from the last yield statement. Any function that contains a yield keyword is termed a generator. Hence, yield is what makes a generator.

Explanation: