Решение на doge от Димитър Мусев

Обратно към всички решения

Към профила на Димитър Мусев

Резултати

  • 6 точки от тестове
  • 6 отнети точки
  • 0 точки общо
  • 9 успешни тест(а)
  • 6 неуспешни тест(а)

Код

def wow_such_much(start, end):
list_num = []
for num in range(start, end):
list_num.append(num)
if (num % 3 == 0) and not (num % 5 == 0):
list_num[list_num.index(num)] = "such"
elif(num % 5 == 0) and not (num % 3 == 0):
list_num[list_num.index(num)] = "much"
elif(num % 3 == 0) and (num % 5 == 0):
list_num[list_num.index(num)] = "suchmuch"
return list_num
def count_doge_words(string):
counter = 0
doge_words = ["lol", "wow", "so", "such", "much", "very"]
for words in doge_words:
if string.count(words):
counter += 1
return counter

Лог от изпълнението

F..F..F.....FFF
======================================================================
FAIL: test_sentence_with_parasite_word_as_part_of_normal_one (test.TestDogeSay)
----------------------------------------------------------------------
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/d20141216-14586-1mlhb05/test.py", line 52, in test_sentence_with_parasite_word_as_part_of_normal_one
    self.assertEqual(2, solution.count_doge_words("wow soon hard such difficult"))
AssertionError: 2 != 3

======================================================================
FAIL: test_with_glued_parasite_words (test.TestDogeSay)
----------------------------------------------------------------------
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/d20141216-14586-1mlhb05/test.py", line 61, in test_with_glued_parasite_words
    self.assertEqual(0, solution.count_doge_words('wowlolsosuchmuchvery'))
AssertionError: 0 != 6

======================================================================
FAIL: test_with_repeating_parasite_words (test.TestDogeSay)
----------------------------------------------------------------------
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/d20141216-14586-1mlhb05/test.py", line 64, in test_with_repeating_parasite_words
    self.assertEqual(5, solution.count_doge_words('wow hard wow much such difficult much'))
AssertionError: 5 != 3

======================================================================
FAIL: test_suchmuch_to_100 (test.TestSuchMuchDoge)
----------------------------------------------------------------------
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/d20141216-14586-1mlhb05/test.py", line 38, in test_suchmuch_to_100
    '92', 'such', '94', 'much', 'such', '97', '98', 'such'])
AssertionError: Lists differ: [1, 2, 'such', 4, 'much', 'suc... != ['1', '2', 'such', '4', 'much'...

First differing element 0:
1
1

Diff is 1840 characters long. Set self.maxDiff to None to see it.

======================================================================
FAIL: test_suchmuch_to_16 (test.TestSuchMuchDoge)
----------------------------------------------------------------------
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/d20141216-14586-1mlhb05/test.py", line 20, in test_suchmuch_to_16
    '11', 'such', '13', '14', 'suchmuch'])
AssertionError: Lists differ: [1, 2, 'such', 4, 'much', 'suc... != ['1', '2', 'such', '4', 'much'...

First differing element 0:
1
1

- [1,
+ ['1',
?  + +

-  2,
+  '2',
?  + +

   'such',
-  4,
+  '4',
?  + +

   'much',
   'such',
-  7,
+  '7',
?  + +

-  8,
+  '8',
?  + +

   'such',
   'much',
-  11,
+  '11',
?  +  +

   'such',
-  13,
+  '13',
?  +  +

-  14,
+  '14',
?  +  +

   'suchmuch']

======================================================================
FAIL: test_suchmuch_to_2 (test.TestSuchMuchDoge)
----------------------------------------------------------------------
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/d20141216-14586-1mlhb05/test.py", line 14, in test_suchmuch_to_2
    self.assertEqual(solution.wow_such_much(1, 2), ['1'])
AssertionError: Lists differ: [1] != ['1']

First differing element 0:
1
1

- [1]
+ ['1']
?  + +


----------------------------------------------------------------------
Ran 15 tests in 0.051s

FAILED (failures=6)

История (3 версии и 1 коментар)

Димитър обнови решението на 12.03.2014 12:10 (преди над 10 години)

+def wow_such_much(start, end):
+ list = []
+ for num in range(start, end):
+ list.append(num)
+ if (num % 3 == 0) and not (num % 5 == 0):
+ list[list.index(num)] = "such"
+ elif(num % 5 == 0) and not (num % 3 == 0):
+ list[list.index(num)] = "much"
+ elif(num % 3 == 0) and (num % 5 == 0):
+ list[list.index(num)] = "suchmuch"
+ return list
+
+def count_doge_word(string):
+ counter = 0
+ doge_words = ["lol", "wow", "so", "such", "much", "very"]
+ for words in doge_words:
+ if string.count(words):
+ counter += 1
+ return counter

Димитър обнови решението на 12.03.2014 12:15 (преди над 10 години)

def wow_such_much(start, end):
list = []
for num in range(start, end):
list.append(num)
if (num % 3 == 0) and not (num % 5 == 0):
list[list.index(num)] = "such"
elif(num % 5 == 0) and not (num % 3 == 0):
list[list.index(num)] = "much"
elif(num % 3 == 0) and (num % 5 == 0):
list[list.index(num)] = "suchmuch"
return list
-def count_doge_word(string):
+def count_doge_words(string):
counter = 0
doge_words = ["lol", "wow", "so", "such", "much", "very"]
for words in doge_words:
if string.count(words):
counter += 1
return counter

Димитър обнови решението на 12.03.2014 13:25 (преди над 10 години)

def wow_such_much(start, end):
- list = []
+ list_num = []
for num in range(start, end):
- list.append(num)
+ list_num.append(num)
if (num % 3 == 0) and not (num % 5 == 0):
- list[list.index(num)] = "such"
+ list_num[list_num.index(num)] = "such"
elif(num % 5 == 0) and not (num % 3 == 0):
- list[list.index(num)] = "much"
+ list_num[list_num.index(num)] = "much"
elif(num % 3 == 0) and (num % 5 == 0):
- list[list.index(num)] = "suchmuch"
- return list
+ list_num[list_num.index(num)] = "suchmuch"
+ return list_num
def count_doge_words(string):
counter = 0
doge_words = ["lol", "wow", "so", "such", "much", "very"]
for words in doge_words:
if string.count(words):
counter += 1
return counter