+ 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❓❓❓

21st Jan 2018, 10:58 AM
Janusz Bujak 🇵🇱 🇺🇦
Janusz Bujak 🇵🇱 🇺🇦 - avatar
1 Odpowiedź
21st Jan 2018, 12:29 PM
Ferhat Sevim
Ferhat Sevim - avatar