Created
November 30, 2014 21:57
-
-
Save ebartrum/1b3ba20f316999bb4281 to your computer and use it in GitHub Desktop.
A solution to the 1st Euler Challenge
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 the sum of all the multiples of 3 or 5 below 1000. | |
"""I will define function mult() which returns true | |
if it's argument is divisible by 3 or 5.""" | |
def mult(x): | |
if x%3==0: | |
return True | |
elif x%5==0: | |
return True | |
else: | |
return False | |
sum=0 | |
for i in range(1000): | |
if mult(i): | |
sum+=i | |
print(sum) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment