Skip to content

Instantly share code, notes, and snippets.

@solen003
Created July 17, 2018 22:32
Show Gist options
  • Save solen003/66122b995d81bb657860605656156ba9 to your computer and use it in GitHub Desktop.
Save solen003/66122b995d81bb657860605656156ba9 to your computer and use it in GitHub Desktop.
Define a class with a generator which can iterate the numbers, which are divisible by 7, between a given range 0 and n.
n = int(input())
divBy7 = [i for i in range(0, n) if (i % 7 == 0)]
print(divBy7)
def divChecker(n):
for i in range(n):
if i % 7 == 0:
value = True
else:
value = False
print(i, value)
divChecker(n)
@Nuke97Q
Copy link

Nuke97Q commented Nov 8, 2022

class Iter:
    def __init__(self):
        pass
        
    def divid(self,n):
        for i in range(0,n):
            if i%7==0:
                print(i)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment