Решение на doge от Деян Камбуров

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

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

Резултати

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

Код

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

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

...............
----------------------------------------------------------------------
Ran 15 tests in 0.169s

OK

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

Деян обнови решението на 10.03.2014 23:59 (преди над 10 години)

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

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

def wow_such_much(start, end):
- result = []
+ wow_such_much_list = []
for i in range(start, end):
if i % 3 == 0 and i % 5 == 0:
- result.append("suchmuch")
+ wow_such_much_list.append("suchmuch")
elif i % 3 == 0:
- result.append("such")
+ wow_such_much_list.append("such")
elif i % 5 == 0:
- result.append("much")
+ wow_such_much_list.append("much")
else:
- result.append(str(i))
- return result
+ wow_such_much_list.append(str(i))
+ return wow_such_much_list
def count_doge_words(sentence):
- result = 0
+ count = 0
doge_words = ("wow", "lol", "so", "such", "much", "very")
- array = sentence.split()
- for word in array:
+ words = sentence.split()
+ for word in words:
if word in doge_words:
- result += 1
- return result
+ count += 1
+ return count