Решение на doge от Моника Ефтимова

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

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

Резултати

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

Код

def wow_such_much(start, end):
"""
Implements FizzBuzz in doge manner.
"""
def check_such_much(number):
return 'such' * (not(number % 3)) + \
'much' * (not(number % 5)) or str(number)
such_much = map(lambda number: check_such_much(number),
range(start, end))
return list(such_much)
def count_doge_words(sentence):
"""
Counts doge words in sentence.
"""
doge_words = ["wow", "lol", "so", "such", "much", "very"]
doge_words_counter = 0
sentence = sentence.split()
for doge_word in doge_words:
doge_words_counter += sentence.count(doge_word)
return doge_words_counter

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

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

OK

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

Моника обнови решението на 10.03.2014 10:13 (преди над 10 години)

+def wow_such_much(start, end):
+ """
+ Implements FizzBuzz in doge manner.
+ """
+ def check_such_much(number):
+ return 'such' * (not(number % 3)) + \
+ 'much' * (not(number % 5)) or number
+ such_much = map(lambda number: check_such_much(number),
+ range(start, end+1))
+ print (list(such_much))

Моника обнови решението на 10.03.2014 10:15 (преди над 10 години)

def wow_such_much(start, end):
"""
Implements FizzBuzz in doge manner.
"""
def check_such_much(number):
return 'such' * (not(number % 3)) + \
'much' * (not(number % 5)) or number
+
such_much = map(lambda number: check_such_much(number),
range(start, end+1))
print (list(such_much))

Моника обнови решението на 10.03.2014 11:51 (преди над 10 години)

def wow_such_much(start, end):
"""
Implements FizzBuzz in doge manner.
"""
def check_such_much(number):
return 'such' * (not(number % 3)) + \
- 'much' * (not(number % 5)) or number
+ 'much' * (not(number % 5)) or str(number)
such_much = map(lambda number: check_such_much(number),
- range(start, end+1))
- print (list(such_much))
+ range(start, end))
+ return list(such_much)
+
+
+def count_doge_words(sentence):
+ """
+ Counts doge words in sentence.
+ """
+ doge_words = ["wow", "lol", "so", "such", "much", "very"]
+ doge_words_counter = 0
+
+ for doge_word in doge_words:
+ doge_words_counter += sentence.count(doge_word)
+
+ return doge_words_counter

Моника обнови решението на 10.03.2014 11:53 (преди над 10 години)

def wow_such_much(start, end):
"""
Implements FizzBuzz in doge manner.
"""
def check_such_much(number):
return 'such' * (not(number % 3)) + \
'much' * (not(number % 5)) or str(number)
such_much = map(lambda number: check_such_much(number),
range(start, end))
return list(such_much)
def count_doge_words(sentence):
"""
Counts doge words in sentence.
"""
doge_words = ["wow", "lol", "so", "such", "much", "very"]
doge_words_counter = 0
for doge_word in doge_words:
doge_words_counter += sentence.count(doge_word)
return doge_words_counter
+

Моника обнови решението на 10.03.2014 11:54 (преди над 10 години)

def wow_such_much(start, end):
"""
Implements FizzBuzz in doge manner.
"""
def check_such_much(number):
return 'such' * (not(number % 3)) + \
'much' * (not(number % 5)) or str(number)
such_much = map(lambda number: check_such_much(number),
range(start, end))
return list(such_much)
-
def count_doge_words(sentence):
"""
Counts doge words in sentence.
"""
doge_words = ["wow", "lol", "so", "such", "much", "very"]
doge_words_counter = 0
for doge_word in doge_words:
doge_words_counter += sentence.count(doge_word)
return doge_words_counter

Моника обнови решението на 10.03.2014 14:27 (преди над 10 години)

def wow_such_much(start, end):
"""
Implements FizzBuzz in doge manner.
"""
def check_such_much(number):
return 'such' * (not(number % 3)) + \
'much' * (not(number % 5)) or str(number)
such_much = map(lambda number: check_such_much(number),
range(start, end))
return list(such_much)
def count_doge_words(sentence):
"""
Counts doge words in sentence.
"""
doge_words = ["wow", "lol", "so", "such", "much", "very"]
doge_words_counter = 0
+ sentence = sentence.split()
+
for doge_word in doge_words:
doge_words_counter += sentence.count(doge_word)
return doge_words_counter