Python-programming-exercises icon indicating copy to clipboard operation
Python-programming-exercises copied to clipboard

Q20: Problem is to provide class, answer is a generator function

Open Kureja opened this issue 7 years ago • 1 comments

As in topic: Problem is to provide class, answer is a generator function You should change "Define a class with a generator which can iterate the numbers" to "Define a generator function which can iterate the numbers" Or change soultion to provide class with iter() and next() for 2.7 or iter() and next() for 3.0+

Kureja avatar Mar 25 '18 11:03 Kureja

n=input() def putNumbers(n): i=0 num=int(n) while i<num: j=i i=i+1 if j%7==0: yield j

print(list(putNumbers(n)))

Kremifany avatar Dec 12 '19 18:12 Kremifany