Jim's
Tutorials

Fall 2018
course
site

Did the second euler problem. Created a totally unnecessary class to solve the problem and used unittest as a framework to test my class. It needs some refactoring but it works. Example output with 1 failed test:

>> python euler_2_test.py
4613732
F..
======================================================================
FAIL: test_add_array (__main__.Euler_2_test)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "euler_2_test.py", line 18, in test_add_array
    self.assertEqual(45, self.array.add_array(even_array))
AssertionError: 45 != 44

----------------------------------------------------------------------
Ran 3 tests in 0.000s

FAILED (failures=1)

example output solving euler 2:

>> python euler2.py
the even sum of even fibonacci numbers under 4000000 is:
4613732

attachments [paper clip]

  last modified size
TXT euler2.py Sat Apr 20 2024 09:23 am 1.2K
TXT euler_2_test.py Sat Apr 20 2024 09:23 am 655B