1def organize(cars, students):
2
3 list_of_students = students
4 list_of_cars = cars
5 lenght_students = len(list_of_students)
6 lenght_cars = len(list_of_cars)
7
8 if not (list_of_cars and list_of_students):
9 return False
10 if lenght_students/ lenght_cars > 4:
11 return False
12
13
14
15 for car in list_of_cars:
16 for student in list_of_students:
17 if not student.car :
18 try:
19 car.add_student(student)
20 if not student.is_comfy():
21 car.remove_student(student)
22
23 except EnvironmentError:
24 continue
25
26 for student in list_of_students:
27 if not student.is_comfy():
28 return False
29
30 return True
31
...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)
n | 1 | def organize (cars, students): | n | 1 | def organize(cars, students): |
2 | 2 | ||||
3 | list_of_students = students | 3 | list_of_students = students | ||
4 | list_of_cars = cars | 4 | list_of_cars = cars | ||
5 | lenght_students = len(list_of_students) | 5 | lenght_students = len(list_of_students) | ||
6 | lenght_cars = len(list_of_cars) | 6 | lenght_cars = len(list_of_cars) | ||
7 | 7 | ||||
8 | if not (list_of_cars and list_of_students): | 8 | if not (list_of_cars and list_of_students): | ||
9 | return False | 9 | return False | ||
10 | if lenght_students/ lenght_cars > 4: | 10 | if lenght_students/ lenght_cars > 4: | ||
11 | return False | 11 | return False | ||
12 | 12 | ||||
n | n | 13 | |||
13 | 14 | ||||
14 | for car in list_of_cars: | 15 | for car in list_of_cars: | ||
15 | for student in list_of_students: | 16 | for student in list_of_students: | ||
16 | if not student.car : | 17 | if not student.car : | ||
17 | try: | 18 | try: | ||
18 | car.add_student(student) | 19 | car.add_student(student) | ||
19 | if not student.is_comfy(): | 20 | if not student.is_comfy(): | ||
20 | car.remove_student(student) | 21 | car.remove_student(student) | ||
n | 21 | n | 22 | ||
22 | except EnvironmentError: | 23 | except EnvironmentError: | ||
23 | continue | 24 | continue | ||
n | 24 | n | 25 | ||
25 | for student in list_of_students: | 26 | for student in list_of_students: | ||
26 | if not student.is_comfy(): | 27 | if not student.is_comfy(): | ||
27 | return False | 28 | return False | ||
28 | 29 | ||||
29 | return True | 30 | return True | ||
t | 30 | t | 31 | ||
31 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|