Решение на Телефонна любов от Александър Томов
Обратно към всички решения
Към профила на Александър Томов
Резултати
- 4 точки от тестове
- 0 бонус точки
- 4 точки общо
- 16 успешни тест(а)
- 21 неуспешни тест(а)
Код
Лог от изпълнението
..F...FF..EF.F....F.E.E.EEE.EEFFEFFFF
======================================================================
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
UnboundLocalError: local variable 'num_answer' referenced before assignment
======================================================================
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
KeyError: (1, 1)
======================================================================
ERROR: 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
KeyError: (None, 1)
======================================================================
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
KeyError: (-1, 3)
======================================================================
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
KeyError: (9, 6)
======================================================================
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
KeyError: (1, 1)
======================================================================
ERROR: 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
KeyError: (0, 4)
======================================================================
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
KeyError: (-1, 2)
======================================================================
ERROR: 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
UnboundLocalError: local variable 'num_answer' referenced before assignment
======================================================================
FAIL: test_ignoring_over_330 (test.TestAnglesToNums)
Test that angles rounded over 330 are ignored.
----------------------------------------------------------------------
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: [11] != []
First list contains 1 additional elements.
First extra element 0:
11
- [11]
+ []
======================================================================
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, 0, 1, 2, 4, 9, 11, 11] != [5, 1, 2, 4, 9, 1, 8, 0, 9]
First differing element 1:
0
1
Second list contains 1 additional elements.
First extra element 8:
9
- [5, 0, 1, 2, 4, 9, 11, 11]
+ [5, 1, 2, 4, 9, 1, 8, 0, 9]
======================================================================
FAIL: test_random_falses (test.TestIsPhonetastic)
Test with a random input resulting in False.
----------------------------------------------------------------------
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: True is not false
======================================================================
FAIL: test_correct_mapping (test.TestNumsToAngles)
Test correct mapping for all numbers.
----------------------------------------------------------------------
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: 0 != 300
======================================================================
FAIL: test_random_mixed_case (test.TestNumsToAngles)
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: 90 != 150
======================================================================
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: [0] != [2, -1, 2, 2, -1, 2, 2, 2, 3, -1, 3, 3, -1[196 chars]9, 0]
First differing element 0:
0
2
Second list contains 74 additional elements.
First extra element 1:
-1
- [0]
+ [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,
+ 8,
+ -1,
+ 8,
+ 8,
+ -1,
+ 8,
+ 8,
+ 8,
+ 9,
+ -1,
+ 9,
+ 9,
+ -1,
+ 9,
+ 9,
+ 9,
+ -1,
+ 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: [6] != [4, 6, -1, 6]
First differing element 0:
6
4
Second list contains 3 additional elements.
First extra element 1:
6
- [6]
+ [4, 6, -1, 6]
======================================================================
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: [3] != [2, -1, 2, 2, 3, -1, 3]
First differing element 0:
3
2
Second list contains 6 additional elements.
First extra element 1:
-1
- [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: [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])
======================================================================
FAIL: test_simple_word (test.TestTextToNums)
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
AssertionError: Lists differ: [6] != [9, 8, 6]
First differing element 0:
6
9
Second list contains 2 additional elements.
First extra element 1:
8
- [6]
+ [9, 8, 6]
======================================================================
FAIL: test_spaces_only (test.TestTextToNums)
Test for input of only whitespaces.
----------------------------------------------------------------------
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: [0] not found in ([0, -1, 0, -1, 0, -1, 0], [0, 0, 0, 0])
----------------------------------------------------------------------
Ran 37 tests in 0.357s
FAILED (failures=12, errors=9)
История (1 версия и 6 коментара)
Александър обнови решението на 03.11.2022 01:58 (преди над 2 години)
Когато проверяваш дали нещо е
None
, иползвамеis
Можеш да unpack-неш и с малко преправяне на името да получиш:
button, clicks = alphabet[letter]
Моля не слагай скоби около усливията на
if
.Моля не слагай скоби около усливията на
if
.Само в случай, че не знаеш - можеш и
angle -= 360
- въпрос на вкус, кое ще използваш.Говорихме за
enumerate
- бих го използвал тук.