Решение на doge от Любомир Коев

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

Към профила на Любомир Коев

Резултати

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

Код

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

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

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

OK

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

Любомир обнови решението на 06.03.2014 03:15 (преди около 10 години)

+def wow_such_much(start, end):
+ nlist = []
+ for item in range(start, end):
+ if item % 5 == 0 and item % 3 == 0:
+ nlist.append('suchmuch')
+ elif item % 5 == 0:
+ nlist.append('much')
+ elif item % 3 == 0:
+ nlist.append('such')
+ else:
+ nlist.append(str(item))
+ return nlist
+
+
+def count_doge_words(inp_str):
+ doge_words = {'wow', 'lol', 'so', 'such', 'much', 'very'}
+ cnt = 0
+ for word in inp_str.split(' '):
+ if word in doge_words:
+ cnt += 1
+ return cnt
+
+
+#such doge-code, much unreadable, very one-line, wow
+
+def wow_such_much_1l(start, end):
+ return list(map(lambda item: 'suchmuch' if item % 3 == 0 and item % 5 == 0 else 'such' if item % 3 == 0 else 'much' if item % 5 == 0 else str(item), range(start, end)))
+
+
+def count_doge_words_1l(inp_str):
+ return sum(list(map(lambda word: 1 if word in {'wow', 'lol', 'so', 'such', 'much', 'very'} else 0 ,inp_str.split(' '))))

Любомир обнови решението на 06.03.2014 11:02 (преди около 10 години)

def wow_such_much(start, end):
nlist = []
for item in range(start, end):
if item % 5 == 0 and item % 3 == 0:
nlist.append('suchmuch')
elif item % 5 == 0:
nlist.append('much')
elif item % 3 == 0:
nlist.append('such')
else:
nlist.append(str(item))
return nlist
def count_doge_words(inp_str):
doge_words = {'wow', 'lol', 'so', 'such', 'much', 'very'}
cnt = 0
for word in inp_str.split(' '):
if word in doge_words:
cnt += 1
return cnt
#such doge-code, much unreadable, very one-line, wow
def wow_such_much_1l(start, end):
return list(map(lambda item: 'suchmuch' if item % 3 == 0 and item % 5 == 0 else 'such' if item % 3 == 0 else 'much' if item % 5 == 0 else str(item), range(start, end)))
def count_doge_words_1l(inp_str):
- return sum(list(map(lambda word: 1 if word in {'wow', 'lol', 'so', 'such', 'much', 'very'} else 0 ,inp_str.split(' '))))
+ return sum(list(map(lambda word: 1 if word in {'wow', 'lol', 'so', 'such', 'much', 'very'} else 0, inp_str.split(' '))))

Любомир обнови решението на 06.03.2014 22:03 (преди около 10 години)

def wow_such_much(start, end):
nlist = []
for item in range(start, end):
if item % 5 == 0 and item % 3 == 0:
nlist.append('suchmuch')
elif item % 5 == 0:
nlist.append('much')
elif item % 3 == 0:
nlist.append('such')
else:
nlist.append(str(item))
return nlist
def count_doge_words(inp_str):
doge_words = {'wow', 'lol', 'so', 'such', 'much', 'very'}
cnt = 0
for word in inp_str.split(' '):
if word in doge_words:
cnt += 1
return cnt
-
-
-#such doge-code, much unreadable, very one-line, wow
-
-def wow_such_much_1l(start, end):
- return list(map(lambda item: 'suchmuch' if item % 3 == 0 and item % 5 == 0 else 'such' if item % 3 == 0 else 'much' if item % 5 == 0 else str(item), range(start, end)))
-
-
-def count_doge_words_1l(inp_str):
- return sum(list(map(lambda word: 1 if word in {'wow', 'lol', 'so', 'such', 'much', 'very'} else 0, inp_str.split(' '))))

Любомир обнови решението на 11.03.2014 00:04 (преди около 10 години)

def wow_such_much(start, end):
- nlist = []
+ doge_numbers = []
for item in range(start, end):
if item % 5 == 0 and item % 3 == 0:
- nlist.append('suchmuch')
+ doge_numbers.append('suchmuch')
elif item % 5 == 0:
- nlist.append('much')
+ doge_numbers.append('much')
elif item % 3 == 0:
- nlist.append('such')
+ doge_numbers.append('such')
else:
- nlist.append(str(item))
- return nlist
+ doge_numbers.append(str(item))
+ return doge_numbers
-def count_doge_words(inp_str):
+def count_doge_words(sentence):
doge_words = {'wow', 'lol', 'so', 'such', 'much', 'very'}
- cnt = 0
- for word in inp_str.split(' '):
+ word_count = 0
+ for word in sentence.split(' '):
if word in doge_words:
- cnt += 1
- return cnt
+ word_count += 1
+ return word_count