Решение на doge от Петър Камбуров

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

Към профила на Петър Камбуров

Резултати

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

Код

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

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

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

OK

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

Петър обнови решението на 07.03.2014 18:31 (преди над 10 години)

+def wow_such_much(start, end):
+ strList = []
+ while start < end:
+ if start % 3 == 0 and start % 5 == 0:
+ strList.append("suchmuch")
+ elif start % 3 == 0:
+ strList.append("such")
+ elif start % 5 == 0:
+ strList.append("much")
+ else:
+ strList.append(str(start))
+ start += 1
+ return strList
+
+def count_doge_words(words):
+ count = 0
+ for w in words.split():
+ if( w == "wow" or
+ w == "lol" or
+ w == "so" or
+ w == "such" or
+ w == "much" or
+ w == "very" ):
+ count += 1
+ return count

Петър обнови решението на 08.03.2014 00:29 (преди над 10 години)

def wow_such_much(start, end):
- strList = []
- while start < end:
- if start % 3 == 0 and start % 5 == 0:
- strList.append("suchmuch")
- elif start % 3 == 0:
- strList.append("such")
- elif start % 5 == 0:
- strList.append("much")
+ str_list = []
+ for i in range(start,end):
+ if i % 3 == 0 and i % 5 == 0:
+ str_list.append("suchmuch")
+ elif i % 3 == 0:
+ str_list.append("such")
+ elif i % 5 == 0:
+ str_list.append("much")
else:
- strList.append(str(start))
- start += 1
- return strList
-
+ str_list.append(str(i))
+ return str_list
def count_doge_words(words):
count = 0
+ doge_words = ("wow", "lol", "so", "such", "much", "very")
for w in words.split():
- if( w == "wow" or
- w == "lol" or
- w == "so" or
- w == "such" or
- w == "much" or
- w == "very" ):
+ if w in doge_words:
count += 1
return count

Петър обнови решението на 11.03.2014 01:03 (преди над 10 години)

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