Предизвикателства > Осмодекемврийско пътуване > Решения > Решението на Камен Колев

Резултати
1 точки от тестове
0 точки от учител

1 точки общо

4 успешни теста
1 неуспешни теста
Код

 1def organize(list_of_cars, list_of_students):
 2    added_students = set()
 3    for car in list_of_cars:
 4            try:
 5                for student in list_of_students:
 6                    if student in added_students:
 7                        continue
 8                    car.add_student(student)
 9                    added_students.add(student)
10                    if not student.is_comfy():
11                        car.remove_student(student)
12                        added_students.remove(student)
13                        raise EnvironmentError("Uncomfortable student")
14                if len(added_students) == len(list_of_students):
15                    return True
16            except EnvironmentError:
17                continue
18    return False

...F.
======================================================================
FAIL: test_regular_case (test.TesFull)
Test a regular case.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/test.py", line 47, in test_regular_case
anti_rusalov_true(self, organize(cars, students))
AssertionError: False is not true

----------------------------------------------------------------------
Ran 5 tests in 0.000s

FAILED (failures=1)

Дискусия
История
Това решение има само една версия.