Решение на doge от Ивайло Бъчваров

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

Към профила на Ивайло Бъчваров

Резултати

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

Код

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

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

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

OK

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

Ивайло обнови решението на 07.03.2014 18:29 (преди над 10 години)

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

Ивайло обнови решението на 07.03.2014 18:55 (преди над 10 години)

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