Решение на doge от Симеон Цветков

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

Към профила на Симеон Цветков

Резултати

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

Код

def wow_such_much(start, end):
list_of_strings = []
for i in range (start, end):
if i % 3 == 0 and not i % 5 == 0:
list_of_strings.append('such')
elif i % 5 == 0 and not i % 3 == 0:
list_of_strings.append('much')
elif i % 3 == 0 and i % 5 == 0:
list_of_strings.append('suchmuch')
else:
list_of_strings.append(str(i))
return list_of_strings
def count_doge_words(sentence):
count_of_words = 0
doge_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
words = sentence.split(' ')
for word in words:
for doge_word in doge_words:
if doge_word == word:
count_of_words += 1
return count_of_words

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

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

OK

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

Симеон обнови решението на 07.03.2014 22:25 (преди над 10 години)

+def wow_such_much(start, end):
+ list_of_strings = []
+ for i in range (start, end):
+ if i % 3 == 0 and not i % 5 == 0:
+ list_of_strings.append('such')
+ elif i % 5 == 0 and not i % 3 == 0:
+ list_of_strings.append('much')
+ elif i % 3 == 0 and i % 5 == 0:
+ list_of_strings.append('suchmuch')
+ else:
+ list_of_strings.append(str(i))
+ return list_of_strings
+
+def count_doge_words(sentence):
+ count_of_words = 0
+ doge_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
+ words = sentence.split(' ')
+ for word in words:
+ for doge_word in doge_words:
+ if doge_word == word:
+ count_of_words += 1
+ return count_of_words