Решение на doge от Дарина Кръстева

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

Към профила на Дарина Кръстева

Резултати

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

Код

DOGE_WORDS = ("wow", "lol", "so", "such", "much", "very")
def wow_such_much(start, end):
numbers_and_doge_words = []
for number in range(start, end):
if number % 15 == 0:
numbers_and_doge_words.append(DOGE_WORDS[3] + DOGE_WORDS[4])
elif number % 3 == 0:
numbers_and_doge_words.append(DOGE_WORDS[3])
elif number % 5 == 0:
numbers_and_doge_words.append(DOGE_WORDS[4])
else:
numbers_and_doge_words.append(str(number))
return numbers_and_doge_words
def count_doge_words(sentence_to_check):
all_sentence_words = sentence_to_check.split()
doge_words_count = 0
for word in all_sentence_words:
if word in DOGE_WORDS:
doge_words_count += 1
return doge_words_count

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

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

OK

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

Дарина обнови решението на 10.03.2014 00:40 (преди над 10 години)

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

Дарина обнови решението на 11.03.2014 13:30 (преди над 10 години)

+DOGE_WORDS = ("wow", "lol", "so", "such", "much", "very")
+
def wow_such_much(start, end):
- string_list = []
+ numbers_and_doge_words = []
for number in range(start, end):
if number % 15 == 0:
- string_list.append("suchmuch")
+ numbers_and_doge_words.append(DOGE_WORDS[3] + DOGE_WORDS[4])
elif number % 3 == 0:
- string_list.append("such")
+ numbers_and_doge_words.append(DOGE_WORDS[3])
elif number % 5 == 0:
- string_list.append("much")
+ numbers_and_doge_words.append(DOGE_WORDS[4])
else:
- string_list.append(str(number))
+ numbers_and_doge_words.append(str(number))
- return string_list
+ return numbers_and_doge_words
def count_doge_words(sentence_to_check):
all_sentence_words = sentence_to_check.split()
- doge_words = ["wow", "lol", "so", "such", "much", "very"]
doge_words_count = 0
for word in all_sentence_words:
- if word in doge_words:
+ if word in DOGE_WORDS:
doge_words_count += 1
return doge_words_count