Skip to content

Instantly share code, notes, and snippets.

@bbookman
Created December 26, 2018 21:39
Show Gist options
  • Save bbookman/949b8fd32f432d4ee7feb1010fa82e47 to your computer and use it in GitHub Desktop.
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
'''
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)
@sumanth-hs27
Copy link

sol = [ n for n in range(1,1001) if n%7 == 0 ]

@shaik23032001
Copy link

res=[y for y in range(1,1000) if y%7==0]

@AldebaranHere
Copy link

solution = [a for a in range(1,1000+1) if a % 7 == 0]

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