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 I run a py file in python shell?
What are the 3 types of relation?
What are the two main data types in python?
What are the differences between the threading and multiprocessing in python?
How do you copy an object in python?
Is python a pop or oop?
What is the main use of python?
What is lambda function in python?
Can a set be sorted python?
What is n in python?
How many data types are there in python?
Is there a double type in python?