Решение на doge от Мариан Ламбовски

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

Към профила на Мариан Ламбовски

Резултати

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

Код

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

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

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

OK

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

Мариан обнови решението на 11.03.2014 22:07 (преди над 10 години)

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

Мариан обнови решението на 12.03.2014 00:05 (преди над 10 години)

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