Решение на doge от Филип Митов

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

Към профила на Филип Митов

Резултати

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

Код

def wow_such_much(start, end):
array_from_strings = []
for i in range(start, end):
if i % 3 == 0 and not i % 5 == 0:
array_from_strings.append("such")
elif not i % 3 == 0 and i % 5 == 0:
array_from_strings.append("much")
elif i % 15 == 0:
array_from_strings.append("suchmuch")
else:
array_from_strings.append(str(i))
return array_from_strings
def count_doge_words(sentence):
parasite_words = {"wow": 1, "lol": 1, "so": 1, "such": 1, "much": 1, "very": 1}
word_sentence = sentence.split()
counter = 0
for i in range (0, len(word_sentence)):
counter += parasite_words.get(word_sentence[i].casefold(), 0)
return counter

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

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

OK

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

Филип обнови решението на 08.03.2014 13:01 (преди над 10 години)

+def wow_such_much(start, end):
+ spisuk = []
+ for i in range(start, end):
+ if i % 3 == 0 and not i % 5 == 0:
+ spisuk.append("such")
+ elif not i % 3 == 0 and i % 5 == 0:
+ spisuk.append("much")
+ elif i % 15 == 0:
+ spisuk.append("suchmuch")
+ else:
+ spisuk.append(str(i))
+
+ return spisuk
+
+def count_doge_words(sentence):
+ bugs = {"wow":1, "lol":1, "so":1, "such":1, "much":1, "very":1}
+ word_sentence = sentence.split()
+ counter = 0
+
+ for i in range (0, len(word_sentence)):
+ counter += bugs.get(word_sentence[i].casefold(), 0)
+
+ return counter

Филип обнови решението на 08.03.2014 14:07 (преди над 10 години)

def wow_such_much(start, end):
- spisuk = []
+ array = []
for i in range(start, end):
if i % 3 == 0 and not i % 5 == 0:
- spisuk.append("such")
+ array.append("such")
elif not i % 3 == 0 and i % 5 == 0:
- spisuk.append("much")
+ array.append("much")
elif i % 15 == 0:
- spisuk.append("suchmuch")
+ array.append("suchmuch")
else:
- spisuk.append(str(i))
+ array.append(str(i))
- return spisuk
+ return array
def count_doge_words(sentence):
bugs = {"wow":1, "lol":1, "so":1, "such":1, "much":1, "very":1}
word_sentence = sentence.split()
counter = 0
for i in range (0, len(word_sentence)):
counter += bugs.get(word_sentence[i].casefold(), 0)
return counter

Филип обнови решението на 10.03.2014 17:24 (преди над 10 години)

def wow_such_much(start, end):
- array = []
+ array_from_strings = []
for i in range(start, end):
if i % 3 == 0 and not i % 5 == 0:
- array.append("such")
+ array_from_strings.append("such")
elif not i % 3 == 0 and i % 5 == 0:
- array.append("much")
+ array_from_strings.append("much")
elif i % 15 == 0:
- array.append("suchmuch")
+ array_from_strings.append("suchmuch")
else:
- array.append(str(i))
+ array_from_strings.append(str(i))
- return array
+ return array_from_strings
def count_doge_words(sentence):
- bugs = {"wow":1, "lol":1, "so":1, "such":1, "much":1, "very":1}
+ parasite_words = {"wow": 1, "lol": 1, "so": 1, "such": 1, "much": 1, "very": 1}
word_sentence = sentence.split()
counter = 0
for i in range (0, len(word_sentence)):
- counter += bugs.get(word_sentence[i].casefold(), 0)
+ counter += parasite_words.get(word_sentence[i].casefold(), 0)
return counter