по задачата 6:
написах генераторче. уж всичко по условия. но тестовете както винаги гърмът при мен.
програмата дава ето такъв резултат:
for prime = 2 #добавено за удобство
(2, 3)
(2, 5)
(2, 7)
for prime = 3
(2, 3)
(3, 5)
(3, 7)
(3, 11)
for prime = 5
(2, 5)
(3, 5)
(5, 7)
(5, 11)
(5, 13)
for prime = 7
(2, 7)
(3, 7)
(5, 7)
(7, 11)
(7, 13)
(7, 17)
for prime = 11
(3, 11)
(5, 11)
(7, 11)
(11, 13)
(11, 17)
(11, 19)
for prime = 13
(5, 13)
(7, 13)
(11, 13)
(13, 17)
(13, 19)
(13, 23)
for prime = 17
(7, 17)
(11, 17)
(13, 17)
(17, 19)
(17, 23)
(17, 29)
като действа ето това
if __name__ == "__main__":
for i in islice(combinePrimes(),0,40):
print i
моля кажете дали това се иска????
теста от своя страна дава това
FF
======================================================================
FAIL: testCombinePrimes (__main__.P6Tester)
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\eclipse\projects\zadacha6\src\p6-sample.py", line 8, in testCombinePrimes
self.assertEqual(self.getCombinedList(5), [(2, 3), (2, 5), (3, 5), (2, 7), (3, 7)])
AssertionError: [(2, 3), (2, 5), (2, 7), (2, 3), (3, 5)] != [(2, 3), (2, 5), (3, 5), (2, 7), (3, 7)]
======================================================================
FAIL: testDoubleSum (__main__.P6Tester)
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\eclipse\projects\zadacha6\src\p6-sample.py", line 11, in testDoubleSum
self.assertEqual(map(sum, self.getCombinedList(11)), [5, 7, 8, 9, 10, 12, 14, 16, 18, 18, 20])
AssertionError: [5, 7, 9, 5, 8, 10, 14, 7, 8, 12, 16] != [5, 7, 8, 9, 10, 12, 14, 16, 18, 18, 20]
----------------------------------------------------------------------
Ran 2 tests in 0.000s
FAILED (failures=2)
вижте тали тука да няма гре