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)
@MouryaMathew
Copy link

sol=[num for num in range(0,10001) if num % 7==0]
print(sol)

@Eddie-Damian
Copy link

numbers = [value for value in range(7,1001,7)]
print(numbers)

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