Програмиране с Python » Форуми » Задачи

задача 6. уточняване на изхода

(5 posts)

  1. uZer
    Member

    по задачата 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)

    вижте тали тука да няма гре

    Posted 6 years ago #
  2. djv
    Member

    Тестът не минава, защото повтаря

    Posted 6 years ago #
  3. uZer
    Member

    да...
    както винаги много подводни камъни...

    мина теста!!!!

    его моя output 0..60, ако искате за сравнение
    (2, 3), (2, 5), (3, 5), (2, 7), (3, 7), (5, 7), (3, 11), (5, 11), (5, 13), (7, 11), (7, 13), (7, 17), (11, 13), (11, 17), (11, 19), (13, 17), (13, 19), (13, 23), (17, 19), (17, 23), (19, 23), (17, 29), (19, 29), (19, 31), (23, 29), (23, 31), (23, 37), (29, 31), (29, 37), (31, 37), (29, 41), (31, 41), (31, 43), (37, 41), (37, 43), (37, 47), (41, 43), (41, 47), (43, 47), (41, 53), (43, 53), (47, 53), (43, 59), (47, 59), (47, 61), (53, 59), (53, 61), (53, 67), (59, 61), (59, 67), (61, 67), (59, 71), (61, 71), (61, 73), (67, 71), (67, 73), (71, 73), (67, 79), (71, 79), (73, 79)

    Posted 6 years ago #
  4. NightMare
    Member

    Моят резултат е същия..

    Posted 6 years ago #
  5. Dancho
    Member

    Бачийски: аз вадя първо (11, 13) и после (7, 17). Надявам се не е проблем. Защото алгоритъмът ми го изисква.

    Posted 6 years ago #

RSS feed for this topic

Reply

You must log in to post.