Решение на doge от Антонио Николов

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

Към профила на Антонио Николов

Резултати

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

Код

def wow_such_much(start, end):
replaced = []
for i in range(start, end):
if i % 15 == 0:
replaced.append('suchmuch')
elif i % 5 == 0:
replaced.append('much')
elif i % 3 == 0:
replaced.append('such')
else:
replaced.append(str(i))
return replaced
def count_doge_words(text):
count = 0
for parasitic_word in ['wow', 'lol', 'so', 'such', 'much', 'very']:
count += text.split().count(parasitic_word)
return count

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

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

OK

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

Антонио обнови решението на 06.03.2014 12:42 (преди около 10 години)

+def wow_such_much(start, end):
+ replaced = []
+ for i in range(start, end):
+ if divmod(i, 15)[1] == 0:
+ replaced.append('suchmuch')
+ elif divmod(i, 5)[1] == 0:
+ replaced.append('much')
+ elif divmod(i, 3)[1] == 0:
+ replaced.append('such')
+ else:
+ replaced.append(str(i))
+ return replaced
+
+def count_doge_words(text):
+ count = 0
+ for parasitic_word in ['wow', 'lol', 'so', 'such', 'much', 'very']:
+ count += text.split().count(parasitic_word)
+ return count

Антонио обнови решението на 10.03.2014 00:50 (преди около 10 години)

def wow_such_much(start, end):
replaced = []
for i in range(start, end):
- if divmod(i, 15)[1] == 0:
+ if i % 15 == 0:
replaced.append('suchmuch')
- elif divmod(i, 5)[1] == 0:
+ elif i % 5 == 0:
replaced.append('much')
- elif divmod(i, 3)[1] == 0:
+ elif i % 3 == 0:
replaced.append('such')
else:
replaced.append(str(i))
return replaced
def count_doge_words(text):
count = 0
for parasitic_word in ['wow', 'lol', 'so', 'such', 'much', 'very']:
count += text.split().count(parasitic_word)
return count