Решение на Телефонна любов от Надежда Панделиева
Обратно към всички решения
Към профила на Надежда Панделиева
Резултати
- 5 точки от тестове
- 1 бонус точка
- 6 точки общо
- 18 успешни тест(а)
- 19 неуспешни тест(а)
Код
Лог от изпълнението
......FFF.E.........EEFEEEEEFEFFFFF..
======================================================================
ERROR: test_empty_input (test.TestIsPhonetastic)
Test with empty input.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
raise result
ZeroDivisionError: integer division or modulo by zero
======================================================================
ERROR: test_all_chars (test.TestNumsToText)
Test for correct mapping of all chars.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
raise result
AttributeError: 'NoneType' object has no attribute 'lower'
======================================================================
ERROR: test_complex_word (test.TestNumsToText)
Test with a complex word that requires -1.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
raise result
AttributeError: 'NoneType' object has no attribute 'lower'
======================================================================
ERROR: test_ending_with_timeout (test.TestNumsToText)
Test with a sequence ending with a -1.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
raise result
AttributeError: 'NoneType' object has no attribute 'lower'
======================================================================
ERROR: test_multiple_timeouts (test.TestNumsToText)
Test with multiple '-1's next to each other.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
raise result
AttributeError: 'NoneType' object has no attribute 'lower'
======================================================================
ERROR: test_overflow_input (test.TestNumsToText)
Test with oveflowing number of presses.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
raise result
AttributeError: 'NoneType' object has no attribute 'lower'
======================================================================
ERROR: test_random_mixed_case (test.TestNumsToText)
Test for a random mixed case.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
raise result
AttributeError: 'NoneType' object has no attribute 'lower'
======================================================================
ERROR: test_simple_word (test.TestNumsToText)
Test with a simple word that doesn't require -1.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
raise result
AttributeError: 'NoneType' object has no attribute 'lower'
======================================================================
ERROR: test_starting_with_timeout (test.TestNumsToText)
Test with a sequence starting with a -1.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
raise result
AttributeError: 'NoneType' object has no attribute 'lower'
======================================================================
FAIL: test_overflowing_angles (test.TestAnglesToNums)
Test with an overflowed input.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
raise result
AssertionError: Lists differ: [] != [2]
Second list contains 1 additional elements.
First extra element 0:
2
- []
+ [2]
? +
======================================================================
FAIL: test_random_mixed_case (test.TestAnglesToNums)
Test with a random mixed input.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
raise result
AssertionError: Lists differ: [5, 1, 2, 4, 9] != [5, 1, 2, 4, 9, 1, 8, 0, 9]
Second list contains 4 additional elements.
First extra element 5:
1
- [5, 1, 2, 4, 9]
+ [5, 1, 2, 4, 9, 1, 8, 0, 9]
======================================================================
FAIL: test_round_angle_direction (test.TestAnglesToNums)
Test with an angle requiring explicit rounding to floor.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
raise result
AssertionError: Lists differ: [2] != [1]
First differing element 0:
2
1
- [2]
+ [1]
======================================================================
FAIL: test_empty_input (test.TestNumsToText)
Test with empty input.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
raise result
AssertionError: None != ''
======================================================================
FAIL: test_spaces_only (test.TestNumsToText)
Test for input of only whitespaces with or without -1.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
raise result
AssertionError: None not found in (' ', ' ')
======================================================================
FAIL: test_all_chars (test.TestTextToNums)
Test for correct mapping of all chars.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
raise result
AssertionError: Lists differ: [2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4,[121 chars]9, 0] != [2, -1, 2, 2, -1, 2, 2, 2, 3, -1, 3, 3, -1, 3[193 chars]9, 0]
First differing element 1:
2
-1
Second list contains 18 additional elements.
First extra element 57:
-1
[2,
+ -1,
2,
2,
+ -1,
2,
2,
2,
3,
+ -1,
3,
3,
+ -1,
3,
3,
3,
4,
+ -1,
4,
4,
+ -1,
4,
4,
4,
5,
+ -1,
5,
5,
+ -1,
5,
5,
5,
6,
+ -1,
6,
6,
+ -1,
6,
6,
6,
7,
+ -1,
+ 7,
+ 7,
+ -1,
7,
7,
7,
+ -1,
- 7,
- 7,
7,
7,
7,
7,
8,
+ -1,
8,
8,
+ -1,
8,
8,
8,
9,
+ -1,
+ 9,
+ 9,
+ -1,
9,
9,
9,
+ -1,
- 9,
- 9,
9,
9,
9,
9,
0]
======================================================================
FAIL: test_complex_word (test.TestTextToNums)
Test with a complex word that requires -1.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
raise result
AssertionError: Lists differ: [4, 6, 6] != [4, 6, -1, 6]
First differing element 2:
6
-1
Second list contains 1 additional elements.
First extra element 3:
6
- [4, 6, 6]
+ [4, 6, -1, 6]
? ++++
======================================================================
FAIL: test_empty_input (test.TestTextToNums)
Test with empty input.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
raise result
AssertionError: Lists differ: [1] != []
First list contains 1 additional elements.
First extra element 0:
1
- [1]
? -
+ []
======================================================================
FAIL: test_mixed_casing (test.TestTextToNums)
Test for both lower and capital case.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
raise result
AssertionError: Lists differ: [2, 2, 2, 3, 3] != [2, -1, 2, 2, 3, -1, 3]
First differing element 1:
2
-1
Second list contains 2 additional elements.
First extra element 5:
-1
- [2, 2, 2, 3, 3]
+ [2, -1, 2, 2, 3, -1, 3]
? ++++ ++++
======================================================================
FAIL: test_random_mixed_case (test.TestTextToNums)
Test for a random mixed case.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
raise result
AssertionError: [8, 8, 8, 2, 7, 7, 7, 7, 5, 5, 6, 6, 6, 0, 0, 0, 5, 2, 2, 2, 2, 8, 2] not found in ([8, 8, 8, 2, 7, 7, 7, 7, 5, 5, 6, 6, 6, 0, -1, 0, -1, 0, 5, 2, -1, 2, 2, -1, 2, 8, 2], [8, 8, 8, 2, 7, 7, 7, 7, 5, 5, 6, 6, 6, 0, 0, 0, 5, 2, -1, 2, 2, -1, 2, 8, 2])
----------------------------------------------------------------------
Ran 37 tests in 0.356s
FAILED (failures=10, errors=9)
История (1 версия и 7 коментара)
Надежда обнови решението на 03.11.2022 17:39 (преди над 2 години)
Малко в повече ми идвата двата цикъла тук. Бих го написал на 2-3 реда. НО ако работи правилно - ок.
def nums_to_text(nums) -> str: result = "" i = 0
def nums_to_text(nums) -> str: result = "" i = 0
Избягвай еднобуквени промнеливи.
letter
е доста по-одбре, особено пък тук, когато заместваl
- нещо което изглежда доста сходно на1
.Напълно приемам забележката.
Напълно приемам забележката.