LINUX.ORG.RU

История изменений

Исправление sniper21, (текущая версия) :

[code=python] def g(): list_1 = [1, 2, 34, 4, 5, 6, 7]

for item in list_1:
    yield item
    item += 1

if name == «main»: h = g() print(next(h)) print(next(h)) print(next(h)) print(next(h))

[/code]

Исходная версия sniper21, :

[code] def g(): list_1 = [1, 2, 34, 4, 5, 6, 7]

for item in list_1:
    yield item
    item += 1

if name == «main»: h = g() print(next(h)) print(next(h)) print(next(h)) print(next(h))

[/code]