Skip to content

Instantly share code, notes, and snippets.

@starhopp3r
Last active May 3, 2018 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save starhopp3r/981efa53628c3e8359d5385b9d18c4d8 to your computer and use it in GitHub Desktop.
Save starhopp3r/981efa53628c3e8359d5385b9d18c4d8 to your computer and use it in GitHub Desktop.
# Numbers between 1534 and 2435 that are divisible by 7
[print(i) for i in range(1534, 2436) if i % 7 == 0]
# Numbers between 1534 and 2435 that are divisible by 7 OR 8
[print(i) for i in range(1534, 2436) if i % 7 == 0 or i % 8 == 0]
# Numbers between 1534 and 2435 that are divisible by 7 AND 8
[print(i) for i in range(1534, 2436) if i % 7 == 0 and i % 8 == 0]
# Last question with user input
stop_num = int(input("Key in stop_num (>1534):"))
divisor = int(input("Key in divisor:"))
[print(i) for i in range(1534, stop_num) if i % divisor == 0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment