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 is the output of this following statement?
What does float () do in python?
Explain deep copy in python?
What is a docstring in python?
What is the usage of enumerate () function in python?
What is the difference between Xrange and range?
What are the two main types of functions?
Explain the disadvantages of python
How to run a Python CGI script in Wamp?
How will you reload a module of python, explain?
What is the sleeping time of giraffe?
How do you get the current working directory using python?