+ 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 Odpowiedź
+ 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