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 count loops in python?
What is a function call or a callable object in python?
What is cgi in python?
Why isn't there a switch or case statement in python?
does recursion cause any trouble?
What is a negative index in python?
Can I build website using python?
What is __ pycache __?
How you can minimize the memcached server outages in your python development?
Can you tell the difference between break and continue in python?
How are data types defined in python and how much bytes do integer and decimal data types hold?
Is there a null in python?