Решение на doge от Ангел Цанев

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

Към профила на Ангел Цанев

Резултати

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

Код

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

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

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

OK

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

Ангел обнови решението на 06.03.2014 14:17 (преди почти 11 години)

+def wow_such_much(begin, end):
+ list = []
+ for i in range(begin, end):
+ if i % 15 == 0:
+ list.append("suchmuch")
+ continue
+ if i % 5 == 0:
+ list.append("much")
+ continue
+ if i % 3 == 0:
+ list.append("such")
+ continue
+ list.append(str(i))
+ return list
+
+def count_doge_words(string):
+ doge_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
+ counter = 0
+ words_given = string.split()
+ for i in range(0, len(words_given)):
+ if words_given[i] in doge_words:
+ counter += 1
+ return counter

Ангел обнови решението на 07.03.2014 11:45 (преди почти 11 години)

def wow_such_much(begin, end):
list = []
for i in range(begin, end):
if i % 15 == 0:
list.append("suchmuch")
- continue
- if i % 5 == 0:
+ elif i % 5 == 0:
list.append("much")
- continue
- if i % 3 == 0:
+ elif i % 3 == 0:
list.append("such")
- continue
- list.append(str(i))
+ else:
+ list.append(str(i))
return list
def count_doge_words(string):
doge_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
counter = 0
words_given = string.split()
for i in range(0, len(words_given)):
if words_given[i] in doge_words:
counter += 1
- return counter
+ return counter

Ангел обнови решението на 07.03.2014 11:55 (преди почти 11 години)

def wow_such_much(begin, end):
list = []
for i in range(begin, end):
- if i % 15 == 0:
- list.append("suchmuch")
- elif i % 5 == 0:
- list.append("much")
- elif i % 3 == 0:
- list.append("such")
- else:
- list.append(str(i))
+ list.append(('such' if i % 3 == 0 else '') + ('much' if i % 5 == 0 else '') or i)
return list
def count_doge_words(string):
doge_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
counter = 0
words_given = string.split()
for i in range(0, len(words_given)):
if words_given[i] in doge_words:
counter += 1
return counter

Ангел обнови решението на 07.03.2014 12:01 (преди почти 11 години)

def wow_such_much(begin, end):
list = []
for i in range(begin, end):
list.append(('such' if i % 3 == 0 else '') + ('much' if i % 5 == 0 else '') or i)
return list
def count_doge_words(string):
doge_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
counter = 0
- words_given = string.split()
- for i in range(0, len(words_given)):
- if words_given[i] in doge_words:
+ for i in range(0, len(string.split())):
+ if string.split()[i] in doge_words:
counter += 1
return counter

Ангел обнови решението на 07.03.2014 20:31 (преди почти 11 години)

def wow_such_much(begin, end):
- list = []
+ result = []
for i in range(begin, end):
- list.append(('such' if i % 3 == 0 else '') + ('much' if i % 5 == 0 else '') or i)
- return list
+ result.append(('such' if i % 3 == 0 else '') + ('much' if i % 5 == 0 else '') or str(i))
+ return result
def count_doge_words(string):
doge_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
counter = 0
for i in range(0, len(string.split())):
if string.split()[i] in doge_words:
counter += 1
return counter

Ангел обнови решението на 11.03.2014 13:19 (преди почти 11 години)

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

Ангел обнови решението на 12.03.2014 00:36 (преди почти 11 години)

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