Решение на doge от Стефан Владков

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

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

Резултати

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

Код

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

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

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

OK

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

Стефан обнови решението на 11.03.2014 23:55 (преди над 10 години)

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

Стефан обнови решението на 12.03.2014 01:51 (преди над 10 години)

def wow_such_much(start, end):
result = []
for counter in range(start, end):
if counter % 3 == 0 and counter % 5 == 0:
result.append('suchmuch')
elif counter % 3 == 0:
result.append('such')
elif counter % 5 == 0:
result.append('much')
else:
result.append(str(counter))
return result
-parasite_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
+PARASITE_WORDS = ['wow', 'lol', 'so', 'such', 'much', 'very']
def count_doge_words(sentence):
words = sentence.split(' ')
words_count = 0
for word in words:
- if word in parasite_words:
+ if word in PARASITE_WORDS:
words_count = words_count + 1
return words_count