class NumberGame:
def __init__(self,start,stop):
self.start = start
self.stop = stop
self.value = self.start - 1
self.pacount = 0
def __iter__(self):
return self
def __next__(self):
if self.value == self.stop:
raise StopIteration
self.value = self.value + 1
if self.value % 7 != 0 and str(self.value).find('7')==-1:
return self.value
else :
self.pacount+=1
return 'pa'
game = NumberGame(1,21)
for each in game:
print(each,end=' ')
网友评论