Решение на doge от Веселин Генадиев

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

Към профила на Веселин Генадиев

Резултати

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

Код

def such_much(number):
if number % 15 == 0:
return 'suchmuch'
elif number % 5 == 0:
return 'much'
elif number % 3 == 0:
return 'such'
else:
return str(number)
def wow_such_much(start, end):
wow_such_muched = [such_much(number) for number in range(start, end)]
return wow_such_muched
def count_doge_words(sentence):
doge_words = {'wow', 'lol', 'so', 'such', 'much', 'very'}
words = sentence.split()
sentence_doge_words = [word for word in words if word in doge_words]
return len(sentence_doge_words)

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

...............
----------------------------------------------------------------------
Ran 15 tests in 0.011s

OK

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

Веселин обнови решението на 06.03.2014 01:59 (преди над 10 години)

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

Веселин обнови решението на 06.03.2014 19:51 (преди над 10 години)

def such_much(number):
if number % 15 == 0:
return 'suchmuch'
elif number % 5 == 0:
return 'much'
elif number % 3 == 0:
return 'such'
else:
return str(number)
def wow_such_much(start, end):
wow_such_muched = [such_much(number) for number in range(start, end)]
return wow_such_muched
def count_doge_words(sentence):
- doge_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
- words = sentence.split(' ')
+ doge_words = {'wow', 'lol', 'so', 'such', 'much', 'very'}
+ words = sentence.split()
sentence_doge_words = [word for word in words if word in doge_words]
return len(sentence_doge_words)