Любомир обнови решението на 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(' '))))
Използвай PEP8 checker:
doge.py:27:80: E501 line too long (172 > 79 characters)
doge.py:31:80: E501 line too long (124 > 79 characters)
doge.py:31:102: E203 whitespace before ','
doge.py:31:103: E231 missing whitespace after ','