Решение на doge от Александър Наджарян

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

Към профила на Александър Наджарян

Резултати

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

Код

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

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

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

OK

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

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

+def wow_such_much(start,end):
+ wow_list = []
+
+ for x in range(start,end):
+ such = x % 3 == 0
+ much = x % 5 == 0
+ if such and much:
+ wow_list.append('suchmuch')
+ elif such:
+ wow_list.append('such')
+ elif much:
+ wow_list.append('much')
+ else:
+ wow_list.append(str(x))
+
+ return wow_list
+
+
+
+def count_doge_words(sentence):
+ doge_words = ('wow', 'lol', 'so', 'such', 'much', 'very')
+
+ sentence = sentence.split()
+ number_of_words = len(sentence)
+ counter = 0
+
+ for x in range(0,number_of_words):
+ if sentence[x] in doge_words:
+ counter += 1
+
+ return counter

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

-def wow_such_much(start,end):
- wow_list = []
-
- for x in range(start,end):
- such = x % 3 == 0
- much = x % 5 == 0
- if such and much:
- wow_list.append('suchmuch')
- elif such:
- wow_list.append('such')
- elif much:
- wow_list.append('much')
+def wow_such_much(start, end):
+ replaced_numbers = []
+
+ for x in range(start, end):
+ if x % 3 == 0 and x % 5 == 0:
+ replaced_numbers.append('suchmuch')
+ elif x % 3 == 0:
+ replaced_numbers.append('such')
+ elif x % 5 == 0:
+ replaced_numbers.append('much')
else:
- wow_list.append(str(x))
-
- return wow_list
+ replaced_numbers.append(str(x))
+ return replaced_numbers
def count_doge_words(sentence):
doge_words = ('wow', 'lol', 'so', 'such', 'much', 'very')
-
+
sentence = sentence.split()
- number_of_words = len(sentence)
counter = 0
-
- for x in range(0,number_of_words):
- if sentence[x] in doge_words:
+
+ for word in sentence:
+ if word in doge_words:
counter += 1
-
+
return counter