Решение на doge от Кирил Киров

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

Към профила на Кирил Киров

Резултати

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

Код

def wow_such_much(start, end):
result = []
while start < end:
if start % 3 == 0 and start % 5 == 0:
result.append("suchmuch")
elif start % 3 == 0:
result.append("such")
elif start % 5 == 0:
result.append("much")
else:
result.append(str(start))
start = start + 1
return result
# 2ra chast
def count_doge_words(string1):
result = 0
str_helper = string1.split()
for i in str_helper:
if i in ["wow", "lol", "so", "such", "much", "very"]:
result = result + 1
return result

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

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

OK

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

Кирил обнови решението на 08.03.2014 00:58 (преди около 10 години)

+def wow_such_much(start, end):
+ a = []
+ while start < end:
+ if start % 3 == 0 and start % 5 == 0:
+ a.append("suchmuch")
+ elif start % 3 == 0:
+ a.append("such")
+ elif start % 5 == 0:
+ a.append("much")
+ else:
+ a.append(start)
+ start = start + 1
+ print(a)
+
+
+def count_doge_words(stringa):
+ a = 0
+ strhelper = stringa.split()
+ for i in strhelper:
+ if i in ["wow", "lol", "so", "such", "much", "very"]:
+ a = a + 1
+ print(a)

Кирил обнови решението на 08.03.2014 12:58 (преди около 10 години)

def wow_such_much(start, end):
- a = []
+ result = []
while start < end:
if start % 3 == 0 and start % 5 == 0:
- a.append("suchmuch")
+ result.append("suchmuch")
elif start % 3 == 0:
- a.append("such")
+ result.append("such")
elif start % 5 == 0:
- a.append("much")
+ result.append("much")
else:
- a.append(start)
+ result.append(str(start))
start = start + 1
- print(a)
+ return result
-def count_doge_words(stringa):
- a = 0
- strhelper = stringa.split()
- for i in strhelper:
+# 2ra chast
+
+def count_doge_words(string1):
+ result = 0
+ str_helper = string1.split()
+ for i in str_helper:
if i in ["wow", "lol", "so", "such", "much", "very"]:
- a = a + 1
- print(a)
+ result = result + 1
+ return result