Решение на doge от Венцислав Димитров

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

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

Резултати

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

Код

def wow_such_much(start, end):
item_list = []
for num in range(start, end):
devision_by_3 = (num % 3) == 0
devision_by_5 = (num % 5) == 0
if devision_by_3 and not devision_by_5:
item_list.append('such')
elif not devision_by_3 and devision_by_5:
item_list.append('much')
elif devision_by_3 and devision_by_5:
item_list.append('suchmuch')
else :
item_list.append(str(num))
return item_list
def count_doge_words(sentence):
counter = 0
bad_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
sentence = sentence.split(' ')
for word in sentence:
if word in bad_words:
counter += 1
return counter

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

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

OK

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

Венцислав обнови решението на 09.03.2014 02:26 (преди над 10 години)

+def wow_such_much(start, end):
+ item_list = []
+ for num in range(start, end):
+ devision_by_3 = (num % 3) == 0
+ devision_by_5 = (num % 5) == 0
+ if devision_by_3 and not devision_by_5:
+ item_list.append('such')
+ elif not devision_by_3 and devision_by_5:
+ item_list.append('much')
+ elif devision_by_3 and devision_by_5:
+ item_list.append('suchmuch')
+ else :
+ item_list.append(str(num))
+ return item_list
+
+def count_doge_words(sentence):
+ counter = 0
+ bad_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
+ sentence = sentence.split(' ')
+ for word in sentence:
+ if word in bad_words:
+ counter += 1
+ return counter