Симеон обнови решението на 07.03.2014 22:25 (преди над 10 години)
+def wow_such_much(start, end):
+ list_of_strings = []
+ for i in range (start, end):
+ if i % 3 == 0 and not i % 5 == 0:
+ list_of_strings.append('such')
+ elif i % 5 == 0 and not i % 3 == 0:
+ list_of_strings.append('much')
+ elif i % 3 == 0 and i % 5 == 0:
+ list_of_strings.append('suchmuch')
+ else:
+ list_of_strings.append(str(i))
+ return list_of_strings
+
+def count_doge_words(sentence):
+ count_of_words = 0
+ doge_words = ['wow', 'lol', 'so', 'such', 'much', 'very']
+ words = sentence.split(' ')
+ for word in words:
+ for doge_word in doge_words:
+ if doge_word == word:
+ count_of_words += 1
+ return count_of_words
Правиш излишно обхождане на всички doge_words
за всяка дума в подаденото изречение :)