Решение на doge от Георги Йорданов

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

Към профила на Георги Йорданов

Резултати

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

Код

def wow_such_much(start, end):
result = []
for i in range(start, end):
if i % 15 == 0:
result.append('suchmuch')
elif i % 5 == 0:
result.append('much')
elif i % 3 == 0:
result.append('such')
else:
result.append(str(i))
return result
def count_doge_words(sentence):
parasitic_words = ('wow', 'lol', 'so', 'such', 'much', 'very')
sentence_words = sentence.split()
result = 0
for word in parasitic_words:
result += sentence_words.count(word)
return result

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

...............
----------------------------------------------------------------------
Ran 15 tests in 0.007s

OK

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

Георги обнови решението на 12.03.2014 11:23 (преди около 10 години)

+def wow_such_much(start, end):
+ result = []
+ for i in range(start, end):
+ if i % 15 == 0:
+ result.append('suchmuch')
+ elif i % 5 == 0:
+ result.append('much')
+ elif i % 3 == 0:
+ result.append('such')
+ else:
+ result.append(str(i))
+ return result
+
+def count_doge_words(sentence):
+ parasitic_words = ('wow', 'lol', 'so', 'such', 'much', 'very')
+ sentence_words = sentence.split()
+ result = 0
+ for word in parasitic_words:
+ result += sentence_words.count(word)
+ return result