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 |
Explain python’s parameter-passing mechanism?
How do we share global variables across modules in Python?
What is the difference between a list and a tuple?
Which is faster c++ or python?
What are the differences between del keyword and clear() function?
What happens if an error occurs that is not handled in the except block?
What do (lambda) function closures capture in python?
Define the support for apex that exists?
What is range and xrange in python?
Explain how you can access sessions in flask?
Which linux is best for python programming?
Why should I learn python in 2019?