Решение на doge от Снежана Спасова

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

Към профила на Снежана Спасова

Резултати

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

Код

DOGE_WORDS = ['wow', 'lol', 'so', 'such', 'much', 'very']
def wow_such_much(start, end):
result = []
for number in range(start, end):
if number % 15 == 0:
result.append('suchmuch')
elif number % 3 == 0:
result.append('such')
elif number % 5 == 0:
result.append('much')
else:
result.append(str(number))
return result
def count_doge_words(string):
return len([x for x in string.split() if x in DOGE_WORDS])

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

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

OK

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

Снежана обнови решението на 06.03.2014 01:02 (преди над 10 години)

+def wow_such_much(start, end):
+ result=[]
+ for number in range(start, end):
+ if number % 5 == 0 and number % 3 == 0:
+ result.append('suchmuch')
+ continue
+ elif number % 3 == 0:
+ result.append('such')
+ elif number % 5 == 0:
+ result.append('much')
+ else:
+ result.append(number)
+ return result
+
+def count_doge_words(string):
+ doge_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
+ return len(list(filter(lambda x: x in doge_words, string.split(" "))))

Снежана обнови решението на 06.03.2014 17:30 (преди над 10 години)

def wow_such_much(start, end):
result=[]
for number in range(start, end):
if number % 5 == 0 and number % 3 == 0:
result.append('suchmuch')
continue
elif number % 3 == 0:
result.append('such')
elif number % 5 == 0:
result.append('much')
else:
- result.append(number)
+ result.append(str(number))
return result
def count_doge_words(string):
doge_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
return len(list(filter(lambda x: x in doge_words, string.split(" "))))

Снежана обнови решението на 07.03.2014 02:31 (преди над 10 години)

def wow_such_much(start, end):
result=[]
for number in range(start, end):
if number % 5 == 0 and number % 3 == 0:
result.append('suchmuch')
continue
elif number % 3 == 0:
result.append('such')
elif number % 5 == 0:
result.append('much')
else:
result.append(str(number))
return result
def count_doge_words(string):
doge_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
- return len(list(filter(lambda x: x in doge_words, string.split(" "))))
+ return len(list(filter(lambda x: x in doge_words, string.split())))

Снежана обнови решението на 08.03.2014 14:59 (преди над 10 години)

def wow_such_much(start, end):
result=[]
for number in range(start, end):
if number % 5 == 0 and number % 3 == 0:
result.append('suchmuch')
continue
elif number % 3 == 0:
result.append('such')
elif number % 5 == 0:
result.append('much')
else:
result.append(str(number))
return result
def count_doge_words(string):
doge_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
- return len(list(filter(lambda x: x in doge_words, string.split())))
+ return len(list(filter(lambda x: x in doge_words, string.lower().split())))

Снежана обнови решението на 08.03.2014 15:03 (преди над 10 години)

def wow_such_much(start, end):
result=[]
for number in range(start, end):
if number % 5 == 0 and number % 3 == 0:
result.append('suchmuch')
- continue
elif number % 3 == 0:
result.append('such')
elif number % 5 == 0:
result.append('much')
else:
result.append(str(number))
return result
def count_doge_words(string):
doge_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
return len(list(filter(lambda x: x in doge_words, string.lower().split())))

Снежана обнови решението на 09.03.2014 23:29 (преди над 10 години)

def wow_such_much(start, end):
result=[]
for number in range(start, end):
if number % 5 == 0 and number % 3 == 0:
result.append('suchmuch')
elif number % 3 == 0:
result.append('such')
elif number % 5 == 0:
result.append('much')
else:
result.append(str(number))
return result
def count_doge_words(string):
doge_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
- return len(list(filter(lambda x: x in doge_words, string.lower().split())))
+ return len(list(filter(lambda x: x in doge_words, string.split())))

Снежана обнови решението на 11.03.2014 12:51 (преди над 10 години)

+DOGE_WORDS = ['wow', 'lol', 'so', 'such', 'much', 'very']
+
def wow_such_much(start, end):
result=[]
for number in range(start, end):
if number % 5 == 0 and number % 3 == 0:
result.append('suchmuch')
elif number % 3 == 0:
result.append('such')
elif number % 5 == 0:
result.append('much')
else:
result.append(str(number))
return result
def count_doge_words(string):
- doge_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
- return len(list(filter(lambda x: x in doge_words, string.split())))
+ return len([x for x in string.split() if x in DOGE_WORDS])

Снежана обнови решението на 11.03.2014 12:52 (преди над 10 години)

DOGE_WORDS = ['wow', 'lol', 'so', 'such', 'much', 'very']
def wow_such_much(start, end):
result=[]
for number in range(start, end):
- if number % 5 == 0 and number % 3 == 0:
+ if number % 15 == 0:
result.append('suchmuch')
elif number % 3 == 0:
result.append('such')
elif number % 5 == 0:
result.append('much')
else:
result.append(str(number))
return result
def count_doge_words(string):
return len([x for x in string.split() if x in DOGE_WORDS])

Снежана обнови решението на 11.03.2014 13:36 (преди над 10 години)

DOGE_WORDS = ['wow', 'lol', 'so', 'such', 'much', 'very']
def wow_such_much(start, end):
- result=[]
+ result = []
for number in range(start, end):
if number % 15 == 0:
result.append('suchmuch')
elif number % 3 == 0:
result.append('such')
elif number % 5 == 0:
result.append('much')
else:
result.append(str(number))
return result
def count_doge_words(string):
return len([x for x in string.split() if x in DOGE_WORDS])