mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 17:34:49 +08:00
Iterative fibonacci with unittests from slash (#882)
* iterative and formula fibonacci methods Added two ways to calculate the fibonacci sequence: (1) iterative (2) formula. I've also added a timer decorator so someone can see the difference in computation time between these two methods. Added two unittests using the slash framework. * Update test_fibonacci.py * remove inline comments per Contributing Guidelines * Update sol5.py * Create placeholder.py * Update and rename maths/test_fibonacci.py to maths/tests/test_fibonacci.py * Delete placeholder.py * Create __init__.py * Update test_fibonacci.py * Rename Maths/lucasSeries.py to maths/lucasSeries.py * Update and rename Project Euler/Problem 01/sol5.py to project_euler/problem_01/sol6.py
This commit is contained in:
9
project_euler/problem_01/sol6.py
Normal file
9
project_euler/problem_01/sol6.py
Normal file
@ -0,0 +1,9 @@
|
||||
a = 3
|
||||
result = 0
|
||||
while a < 1000:
|
||||
if(a % 3 == 0 or a % 5 == 0):
|
||||
result += a
|
||||
elif(a % 15 == 0):
|
||||
result -= a
|
||||
a += 1
|
||||
print(result)
|
Reference in New Issue
Block a user