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 |
What are the optional statements that can be used inside a <try-except> block in python?
What is %s %d in python?
Definition of %s in python?
How can you share global variables across modules?
Explain the use of // operator in python?
How do I emulate os.kill() in windows?
Explain the inheritance in python with an example?
What is the other way of checking truthiness?
How do I run python?
Name few python shells?
How to convert a numpy array to a python list?
Is python can be compatible with command prompt?