what does yield function do? what is the difference between return and yield?
Answer Posted / 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 |
Post New Answer View All Answers
How you can access sessions in flask?
What is the Java implementation of Python popularly known as?
What is indexing? Explain with an example
What is Dict and List comprehensions are?
What are disadvantages of python?
How to clone or copy a list in python?
What is set in python 3?
Can a class extend itself?
Does python have multiple inheritance?
Explain different ways to create an empty numpy array in python?
How python supports encapsulation with respect to functions?
Is numeric in python?
Does python have null?
Which compiler is best for python?
What is a program interpreter?