- Коректно
- 5 успешни тест(а)
- 0 неуспешни тест(а)
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
Срокът за предаване на решения е отминал
Нарцисизъм означава любов към себе си и се свързва с преследването на удовлетворение от суетата или егоистично възхищение на собстевните физически или умствени качества. Произлиза във връзка с Нарцис) от древногръцката митология, който се влюбил във собственото си отражение.
Числа влюбени в себе си (очевидно).
Естественото (в рамките на тази задача ще считаме и 0 за естествено) число n
се нарича нарцистично, ако изпълнява следното условие:
$$ n = a_k^k + a_{k-1}^k + \ldots + a_2^k + a_1^k $$
Тоест сумата от цифрите на числото, повдигнати на степен броя на цифрите, да е самото число.
$$ 370_{(10)} = 3^3 + 7^3 + 0^3 = 27 + 343 + 0 = 370_{(10)} $$
$$ 5_{(10)} = 12_{(3)} = 1^2 + 2^2 = 1 + 4 = 5_{(10)} $$
Аналогично стоят нещата и при числа в произволна бройна система.
Да проследим един пример с 223 в 4-ична бройна система:
Ако числото е в 11-ична бройна система, включва цифрата A
и се чудите как да
повдигнете A
на дадена степен, просто повдигнете 10 на тази степен, което е
същото, защото A
в 11-ична е 10 в 10-ична.
Като видни нарцисисти напишете функция предикат is_narcissistic
, която, по
дадено число и бройна система(2-36), ви помага да разберете дали числото е
нарцистично, или не.
base
параметърът указва бройната система, в която е number
и по
подразбиране е 10
. number
е числото, представено като низ.
def is_narcissistic(number, base=10)
...
>> is_narcissistic('10')
False
>> is_narcissistic('223', 4)
True
>> is_narcissistic('115132219018763992565095597973971522401')
True
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..E.. ====================================================================== ERROR: test_with_numbers_in_higher_bases_with_digits_greater_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-5t0s36/test.py", line 25, in test_with_numbers_in_higher_bases_with_digits_greater_than_9 self.assertTrue(solution.is_narcissistic('A', 11)) File "/tmp/d20140318-21201-5t0s36/solution.py", line 24, in is_narcissistic return number_in_dec == sum([int(digit)**power for digit in number]) File "/tmp/d20140318-21201-5t0s36/solution.py", line 24, in <listcomp> return number_in_dec == sum([int(digit)**power for digit in number]) ValueError: invalid literal for int() with base 10: 'A' ---------------------------------------------------------------------- Ran 5 tests in 0.004s FAILED (errors=1)
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.021s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.002s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..E.. ====================================================================== ERROR: test_with_numbers_in_higher_bases_with_digits_greater_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-r6pegp/test.py", line 25, in test_with_numbers_in_higher_bases_with_digits_greater_than_9 self.assertTrue(solution.is_narcissistic('A', 11)) File "/tmp/d20140318-21201-r6pegp/solution.py", line 3, in is_narcissistic for digit in number]) == int(number, base) File "/tmp/d20140318-21201-r6pegp/solution.py", line 3, in <listcomp> for digit in number]) == int(number, base) ValueError: invalid literal for int() with base 10: 'A' ---------------------------------------------------------------------- Ran 5 tests in 0.004s FAILED (errors=1)
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..E.. ====================================================================== ERROR: test_with_numbers_in_higher_bases_with_digits_greater_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-pnaick/test.py", line 25, in test_with_numbers_in_higher_bases_with_digits_greater_than_9 self.assertTrue(solution.is_narcissistic('A', 11)) File "/tmp/d20140318-21201-pnaick/solution.py", line 5, in is_narcissistic result += int(digit) ** power ValueError: invalid literal for int() with base 10: 'A' ---------------------------------------------------------------------- Ran 5 tests in 0.004s FAILED (errors=1)
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..F.. ====================================================================== FAIL: test_with_numbers_in_higher_bases_with_digits_greater_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-ja1otk/test.py", line 26, in test_with_numbers_in_higher_bases_with_digits_greater_than_9 self.assertTrue(solution.is_narcissistic('C60E7', 16)) AssertionError: False is not true ---------------------------------------------------------------------- Ran 5 tests in 0.004s FAILED (failures=1)
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..E.. ====================================================================== ERROR: test_with_numbers_in_higher_bases_with_digits_greater_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-i4ih1b/test.py", line 25, in test_with_numbers_in_higher_bases_with_digits_greater_than_9 self.assertTrue(solution.is_narcissistic('A', 11)) File "/tmp/d20140318-21201-i4ih1b/solution.py", line 5, in is_narcissistic sum_base += int(digit) * base ** power ValueError: invalid literal for int() with base 10: 'A' ---------------------------------------------------------------------- Ran 5 tests in 0.004s FAILED (errors=1)
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..E.. ====================================================================== ERROR: test_with_numbers_in_higher_bases_with_digits_greater_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-1xii06k/test.py", line 25, in test_with_numbers_in_higher_bases_with_digits_greater_than_9 self.assertTrue(solution.is_narcissistic('A', 11)) File "/tmp/d20140318-21201-1xii06k/solution.py", line 4, in is_narcissistic digits_sum += int(i) ** len(number) ValueError: invalid literal for int() with base 10: 'A' ---------------------------------------------------------------------- Ran 5 tests in 0.004s FAILED (errors=1)
..E.. ====================================================================== ERROR: test_with_numbers_in_higher_bases_with_digits_greater_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-kqcr9l/test.py", line 25, in test_with_numbers_in_higher_bases_with_digits_greater_than_9 self.assertTrue(solution.is_narcissistic('A', 11)) File "/tmp/d20140318-21201-kqcr9l/solution.py", line 12, in is_narcissistic return b==sum(number) File "/tmp/d20140318-21201-kqcr9l/solution.py", line 4, in sum c = list(map(int,str(int(a)))) ValueError: invalid literal for int() with base 10: 'A' ---------------------------------------------------------------------- Ran 5 tests in 0.004s FAILED (errors=1)
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..E.. ====================================================================== ERROR: test_with_numbers_in_higher_bases_with_digits_greater_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-18m3nrl/test.py", line 25, in test_with_numbers_in_higher_bases_with_digits_greater_than_9 self.assertTrue(solution.is_narcissistic('A', 11)) File "/tmp/d20140318-21201-18m3nrl/solution.py", line 12, in is_narcissistic return temp_number == calculate(expresion) File "/tmp/d20140318-21201-18m3nrl/solution.py", line 5, in calculate result += int(i)**lenth_number ValueError: invalid literal for int() with base 10: 'A' ---------------------------------------------------------------------- Ran 5 tests in 0.004s FAILED (errors=1)
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.094s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..E.. ====================================================================== ERROR: test_with_numbers_in_higher_bases_with_digits_greater_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-1l7fgy5/test.py", line 25, in test_with_numbers_in_higher_bases_with_digits_greater_than_9 self.assertTrue(solution.is_narcissistic('A', 11)) File "/tmp/d20140318-21201-1l7fgy5/solution.py", line 9, in is_narcissistic digits = [int(digit_chr) for digit_chr in number] File "/tmp/d20140318-21201-1l7fgy5/solution.py", line 9, in <listcomp> digits = [int(digit_chr) for digit_chr in number] ValueError: invalid literal for int() with base 10: 'A' ---------------------------------------------------------------------- Ran 5 tests in 0.004s FAILED (errors=1)
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..E.. ====================================================================== ERROR: test_with_numbers_in_higher_bases_with_digits_greater_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-1hbk4y7/test.py", line 25, in test_with_numbers_in_higher_bases_with_digits_greater_than_9 self.assertTrue(solution.is_narcissistic('A', 11)) File "/tmp/d20140318-21201-1hbk4y7/solution.py", line 14, in is_narcissistic digits = num_digits( int( number ) ) ValueError: invalid literal for int() with base 10: 'A' ---------------------------------------------------------------------- Ran 5 tests in 0.004s FAILED (errors=1)
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..E.. ====================================================================== ERROR: test_with_numbers_in_higher_bases_with_digits_greater_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-1d39y3s/test.py", line 25, in test_with_numbers_in_higher_bases_with_digits_greater_than_9 self.assertTrue(solution.is_narcissistic('A', 11)) File "/tmp/d20140318-21201-1d39y3s/solution.py", line 3, in is_narcissistic for i in number]) == int(number, base) File "/tmp/d20140318-21201-1d39y3s/solution.py", line 3, in <listcomp> for i in number]) == int(number, base) ValueError: invalid literal for int() with base 10: 'A' ---------------------------------------------------------------------- Ran 5 tests in 0.004s FAILED (errors=1)
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.154s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.098s OK
..E.. ====================================================================== ERROR: test_with_numbers_in_higher_bases_with_digits_greater_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-1p6bbve/test.py", line 25, in test_with_numbers_in_higher_bases_with_digits_greater_than_9 self.assertTrue(solution.is_narcissistic('A', 11)) File "/tmp/d20140318-21201-1p6bbve/solution.py", line 7, in is_narcissistic return number == sum([(char_to_10(digit))** k for digit in number_string]) File "/tmp/d20140318-21201-1p6bbve/solution.py", line 7, in <listcomp> return number == sum([(char_to_10(digit))** k for digit in number_string]) File "/tmp/d20140318-21201-1p6bbve/solution.py", line 2, in char_to_10 return '0123456789abcdefghijklmnopqrstuvwxyz'.index(char) ValueError: substring not found ---------------------------------------------------------------------- Ran 5 tests in 0.005s FAILED (errors=1)
..... ---------------------------------------------------------------------- Ran 5 tests in 0.114s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..E.. ====================================================================== ERROR: test_with_numbers_in_higher_bases_with_digits_greater_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-12akiuu/test.py", line 25, in test_with_numbers_in_higher_bases_with_digits_greater_than_9 self.assertTrue(solution.is_narcissistic('A', 11)) File "/tmp/d20140318-21201-12akiuu/solution.py", line 2, in is_narcissistic based_digits = str(int(number)) ValueError: invalid literal for int() with base 10: 'A' ---------------------------------------------------------------------- Ran 5 tests in 0.004s FAILED (errors=1)
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..E.. ====================================================================== ERROR: test_with_numbers_in_higher_bases_with_digits_greater_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-1ixr1wz/test.py", line 25, in test_with_numbers_in_higher_bases_with_digits_greater_than_9 self.assertTrue(solution.is_narcissistic('A', 11)) File "/tmp/d20140318-21201-1ixr1wz/solution.py", line 18, in is_narcissistic narcissistic_candidate += int(digit) ** len(number) ValueError: invalid literal for int() with base 10: 'A' ---------------------------------------------------------------------- Ran 5 tests in 0.004s FAILED (errors=1)
..E.. ====================================================================== ERROR: test_with_numbers_in_higher_bases_with_digits_greater_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-177xzhz/test.py", line 25, in test_with_numbers_in_higher_bases_with_digits_greater_than_9 self.assertTrue(solution.is_narcissistic('A', 11)) File "/tmp/d20140318-21201-177xzhz/solution.py", line 2, in is_narcissistic return sum(int(x) ** len(number) for x in number) == int(number, base) File "/tmp/d20140318-21201-177xzhz/solution.py", line 2, in <genexpr> return sum(int(x) ** len(number) for x in number) == int(number, base) ValueError: invalid literal for int() with base 10: 'A' ---------------------------------------------------------------------- Ran 5 tests in 0.004s FAILED (errors=1)
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..E.. ====================================================================== ERROR: test_with_numbers_in_higher_bases_with_digits_greater_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-4ahl76/test.py", line 25, in test_with_numbers_in_higher_bases_with_digits_greater_than_9 self.assertTrue(solution.is_narcissistic('A', 11)) File "/tmp/d20140318-21201-4ahl76/solution.py", line 23, in is_narcissistic converted_number = convertNumber([int(c) for c in number], base, 10) File "/tmp/d20140318-21201-4ahl76/solution.py", line 23, in <listcomp> converted_number = convertNumber([int(c) for c in number], base, 10) ValueError: invalid literal for int() with base 10: 'A' ---------------------------------------------------------------------- Ran 5 tests in 0.005s FAILED (errors=1)
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
EEEF Stdout: 1 1 F Stdout: 684 243 738 128 ====================================================================== ERROR: test_default_base_is_ten (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-1gw268a/test.py", line 8, in test_default_base_is_ten self.assertTrue(solution.is_narcissistic('153')) TypeError: is_narcissistic() missing 1 required positional argument: 'base' ====================================================================== ERROR: test_with_numbers_in_base_ten (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-1gw268a/test.py", line 11, in test_with_numbers_in_base_ten self.assertTrue(solution.is_narcissistic('32164049651')) TypeError: is_narcissistic() missing 1 required positional argument: 'base' ====================================================================== ERROR: test_with_numbers_in_higher_bases_with_digits_greater_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-1gw268a/test.py", line 25, in test_with_numbers_in_higher_bases_with_digits_greater_than_9 self.assertTrue(solution.is_narcissistic('A', 11)) File "/tmp/d20140318-21201-1gw268a/solution.py", line 10, in is_narcissistic narcissistic_sum += int(digits) ** power ValueError: invalid literal for int() with base 10: 'A' ====================================================================== FAIL: test_with_numbers_in_lower_bases (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-1gw268a/test.py", line 15, in test_with_numbers_in_lower_bases self.assertTrue(solution.is_narcissistic('1', 2)) AssertionError: False is not true Stdout: 1 1 ====================================================================== FAIL: test_with_with_numbers_in_higher_bases_with_digits_less_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-1gw268a/test.py", line 21, in test_with_with_numbers_in_higher_bases_with_digits_less_than_9 self.assertTrue(solution.is_narcissistic('192', 23)) AssertionError: False is not true Stdout: 684 243 738 128 ---------------------------------------------------------------------- Ran 5 tests in 0.005s FAILED (failures=2, errors=3)
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.057s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.003s OK
..... ---------------------------------------------------------------------- Ran 5 tests in 0.004s OK
..E.. ====================================================================== ERROR: test_with_numbers_in_higher_bases_with_digits_greater_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-15mqc1r/test.py", line 25, in test_with_numbers_in_higher_bases_with_digits_greater_than_9 self.assertTrue(solution.is_narcissistic('A', 11)) File "/tmp/d20140318-21201-15mqc1r/solution.py", line 20, in is_narcissistic polynomial = polynomial + int(digit) ** number_length ValueError: invalid literal for int() with base 10: 'A' ---------------------------------------------------------------------- Ran 5 tests in 0.004s FAILED (errors=1)
..F.. ====================================================================== FAIL: test_with_numbers_in_higher_bases_with_digits_greater_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-1hvrpe8/test.py", line 26, in test_with_numbers_in_higher_bases_with_digits_greater_than_9 self.assertTrue(solution.is_narcissistic('C60E7', 16)) AssertionError: False is not true ---------------------------------------------------------------------- Ran 5 tests in 0.004s FAILED (failures=1)
EEE.. ====================================================================== ERROR: test_default_base_is_ten (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-ag8nm2/test.py", line 8, in test_default_base_is_ten self.assertTrue(solution.is_narcissistic('153')) TypeError: is_narcissistic() missing 1 required positional argument: 'num_sys' ====================================================================== ERROR: test_with_numbers_in_base_ten (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-ag8nm2/test.py", line 11, in test_with_numbers_in_base_ten self.assertTrue(solution.is_narcissistic('32164049651')) TypeError: is_narcissistic() missing 1 required positional argument: 'num_sys' ====================================================================== ERROR: test_with_numbers_in_higher_bases_with_digits_greater_than_9 (test.TestNarcissisticNumbers) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/language/python/runner.py", line 60, in thread raise it.exc_info[1] File "lib/language/python/runner.py", line 48, in run self.result = func(*args, **kwargs) File "/tmp/d20140318-21201-ag8nm2/test.py", line 25, in test_with_numbers_in_higher_bases_with_digits_greater_than_9 self.assertTrue(solution.is_narcissistic('A', 11)) File "/tmp/d20140318-21201-ag8nm2/solution.py", line 13, in is_narcissistic for_check = int(num) ValueError: invalid literal for int() with base 10: 'A' ---------------------------------------------------------------------- Ran 5 tests in 0.005s FAILED (errors=3)