What is difference between yeild and return

what is difference between yeild and return

hey @hssharma2212000 ,
Both yield and returns works a kind of similar but they do have a difference.
yield is basically used to return a sequence of values where as return is used when we want to return a specific/single value .
Yield is generally used in data generators which returns sequence pf data to work on some task , like the way we train our deep learning model on generators.

I hope this would have resolved your doubt.
Thank You.
Happy Coding :slightly_smiling_face: .

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.