-
-
Save bbookman/949b8fd32f432d4ee7feb1010fa82e47 to your computer and use it in GitHub Desktop.
Python List Comprehension: Find all of the numbers from 1-1000 that are divisible by 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Find all of the numbers from 1-1000 that are divisible by 7 | |
''' | |
div7 = [n for n in range(1,1000) if n % 7 == 0] | |
print(div7) |
res=[y for y in range(1,1000) if y%7==0]
solution = [a for a in range(1,1000+1) if a % 7 == 0]
res = [n for n in range(1,1001) if n % 7 ==0)
div_by_7 = [num for num inn range(1001) if num % 7 == 0]
print(div_by_7)
list= [i for i in range(1,1001) if i%7==0]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sol = [ n for n in range(1,1001) if n%7 == 0 ]