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 do you think is the output of the following code fragment?
Is python a programming?
Explain about assert statement?
What is the difference between local vs global in python?
What is the python interactive console or python shell?
Are there any interfaces to database packages in python?
What is the best free ide for python?
In Python, how do you remark numerous lines?
What is the result of pow(x,y)?
Explain the database connection in python flask?
Why is the order in python dictionaries and sets arbitrary?
How can you randomize the items of a list in place in python?