Решение на doge от Дамян Манев

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

Към профила на Дамян Манев

Резултати

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

Код

DOGE_WORDS = ('wow', 'lol', 'so', 'such', 'much', 'very')
def count_doge_words(sentence):
words_from_sentence = sentence.split()
counter = 0
for i in words_from_sentence:
if i in DOGE_WORDS:
counter += 1
return counter
def wow_such_much(start, end):
changed_words = []
counter = 0
for i in range(start, end):
changed_words.append("")
changed_words[counter] = "such"*(i%3 == 0) + "much" *(i%5 == 0)
if changed_words[counter] == "":
changed_words[counter] = str(i)
counter += 1
return changed_words

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

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

OK

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

Дамян обнови решението на 11.03.2014 11:05 (преди над 10 години)

+DOGE_WORDS =('wow', 'lol', 'so', 'such', 'much', 'very')
+def count_doge_words(sentence):
+ words_list = sentence.split()
+ counter = 0
+ for i in words_list:
+ if i in DOGE_WORDS:
+ counter += 1
+ return counter
+
+def wow_such_much(start, end):
+ arr = []
+ counter = 0
+ for i in range(start, end):
+ arr.append("")
+ arr[counter] = "such"*(i%3 == 0) + "much"*(i%5 == 0)
+ if arr[counter] == "":
+ arr[counter] = str(i)
+ counter += 1
+ return arr

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

-DOGE_WORDS =('wow', 'lol', 'so', 'such', 'much', 'very')
+DOGE_WORDS = ('wow', 'lol', 'so', 'such', 'much', 'very')
+
def count_doge_words(sentence):
- words_list = sentence.split()
+ words_from_sentence = sentence.split()
counter = 0
- for i in words_list:
+ for i in words_from_sentence:
if i in DOGE_WORDS:
counter += 1
return counter
def wow_such_much(start, end):
- arr = []
+ changed_words = []
counter = 0
for i in range(start, end):
- arr.append("")
- arr[counter] = "such"*(i%3 == 0) + "much"*(i%5 == 0)
- if arr[counter] == "":
- arr[counter] = str(i)
+ changed_words.append("")
+ changed_words[counter] = "such"*(i%3 == 0) + "much" *(i%5 == 0)
+ if changed_words[counter] == "":
+ changed_words[counter] = str(i)
counter += 1
- return arr
+ return changed_words