Moved 1 to 5 to Python and learned a ton.
This commit is contained in:
11
python/e001.py
Normal file
11
python/e001.py
Normal file
@@ -0,0 +1,11 @@
|
||||
def get_sum_of_natural_dividable_by_3_and_5_below(m):
|
||||
return sum([x for x in range(m) if x % 3 == 0 or x % 5 == 0])
|
||||
|
||||
|
||||
def euler_001():
|
||||
return get_sum_of_natural_dividable_by_3_and_5_below(1000)
|
||||
|
||||
|
||||
assert(get_sum_of_natural_dividable_by_3_and_5_below(10) == 23)
|
||||
assert(euler_001() == 233168)
|
||||
print("e001.py: {}".format(euler_001()))
|
||||
Reference in New Issue
Block a user