+ 12
Python: return vs yieldâźď¸
Who can explainâď¸ def fun(): return 1 print(fun()) def gen(): return 2 # didn't work yield 3 print(gen()) OUTPUT 1 <generator object gen at ...... > # But whyâââ
1 Answer
+ 5
You can read here.
https://www.programiz.com/JUMP_LINK__&&__python__&&__JUMP_LINK-programming/generator
I have an example how to use generators yield
https://code.sololearn.com/cA8872jH3I99/?ref=app