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
What is deep copy in python?
Explain what is namespace in python?
How to handle deadlock in python.
Tell me what is the difference between xrange and range?
What is data type set in python and how to work with it?
How do you disconnect from the database?
Does python have a built in function for string natural sort?
How is python used in business?
What’s your preferred text editor?
How can you unsign or delete variable in python?
What is ord () in python?
What are the differences in list and tuple?
Is python string mutable?
Why you should learn python in 2019?
Explain how can you generate random numbers in python?