what does yield function do? what is the difference between return and yield?
Answer / siva kumar reddy dandu
Yield function keeps all single return values and return all at a time as a list
Yield and return both are used for returning the values from function.
Generally yield is used with iterators, So yield will keep all the return values of each iterative call and returns final result at the end of call as List where as return can return one value for each function call.
| Is This Answer Correct ? | 0 Yes | 0 No |
How do you convert string as a variable name in python?
How do you sort in python 3?
What is the purpose of the single underscore “_” variable in python?
Use of double quotes and single quote in python?
Explain assert in action?
What are docstrings and comments?
What are tuples in python?
What are the basic data types supported by python?
Is Python an easy-to-learn language
What tuple means?
Which database is best for python?
Explain how python does compile-time and run-time code checking?