Skip to content

Instantly share code, notes, and snippets.

@drvinceknight
Created October 15, 2015 10:20
Show Gist options
  • Save drvinceknight/ad53821387bfb73df098 to your computer and use it in GitHub Desktop.
Save drvinceknight/ad53821387bfb73df098 to your computer and use it in GitHub Desktop.
count = 0 # Initialising a variable to count numbers divisible by 11
s = 0 # Initialising a variable to add all numbers divisible by 11
powers = 1 # Multiple 2 together as many times as we have numbers divisible by 11
for i in range(101): # Loop over numbers we want
if i % 11 == 0: # Identify numbers that are divisible by 11
count += + 1 # Add 1
s += i # Add the number itself
powers = powers * 2 # Multiple by 2
print count, s, powers # Print all of these
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment