Решение на doge от Александър Михайлов

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

Към профила на Александър Михайлов

Резултати

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

Код

def wow_such_much(start, end):
such_much_result = []
for num_to_divide in range(start, end):
if num_to_divide % 15 == 0 :
such_much_result.append('suchmuch')
elif num_to_divide % 3 == 0 :
such_much_result.append('such')
elif num_to_divide % 5 == 0 :
such_much_result.append('much')
else :
such_much_result.append(str(num_to_divide))
return such_much_result
def count_doge_words(string) :
word_counter = 0
doge_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
for word in range(0, len(doge_words)) :
if doge_words[word] in string.split() :
word_counter += string.count(doge_words[word])
return word_counter

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

...............
----------------------------------------------------------------------
Ran 15 tests in 0.010s

OK

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

Александър обнови решението на 12.03.2014 00:30 (преди над 10 години)

+def wow_such_much(start, end):
+
+ such_much_result = []
+
+ for num_to_divide in range(start, end):
+
+ if num_to_divide % 15 == 0 :
+ such_much_result.append('suchmuch')
+
+ elif num_to_divide % 3 == 0 :
+ such_much_result.append('such')
+
+ elif num_to_divide % 5 == 0 :
+ such_much_result.append('much')
+
+ else :
+ such_much_result.append(str(num_to_divide))
+
+ return such_much_result
+
+def count_doge_words(string) :
+
+ word_counter = 0
+ doge_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
+
+ for word in range(0, 5) :
+
+ if doge_words[word] in string :
+ word_counter += 1
+
+ return word_counter

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

def wow_such_much(start, end):
such_much_result = []
-
for num_to_divide in range(start, end):
if num_to_divide % 15 == 0 :
such_much_result.append('suchmuch')
-
elif num_to_divide % 3 == 0 :
such_much_result.append('such')
-
elif num_to_divide % 5 == 0 :
such_much_result.append('much')
-
else :
such_much_result.append(str(num_to_divide))
return such_much_result
def count_doge_words(string) :
word_counter = 0
doge_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
-
- for word in range(0, 5) :
+ for word in range(0, len(doge_words)) :
- if doge_words[word] in string :
- word_counter += 1
+ if doge_words[word] in string.split() :
+ word_counter += string.count(doge_words[word])
- return word_counter
+ return word_counter
+