-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode6.py
More file actions
41 lines (37 loc) · 989 Bytes
/
code6.py
File metadata and controls
41 lines (37 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# 출처 : https://school.programmers.co.kr/learn/courses/30/lessons/120956
# 옹알이
def check_word(w, words):
answer = 0
for wo in words:
if w.startswith(wo):
answer += 1
w = w[len(wo):]
break
return answer, w, wo
def include(w, words):
isInclude = False
for wo in words:
if w.startswith(wo):
isInclude = True
break
return isInclude
def check(word):
go = True
words = ["aya","ye", "woo", "ma"]
results = 0
while go:
result, word, wo = check_word(word, words)
index = words.index(wo)
del words[index]
results += result
if word == '':
go = False
elif not include(word, words):
go = False
results = 0
return results
def solution(babbling):
answer = []
for index in range(0, len(babbling)):
answer.append(check(babbling[index]))
return len([a for a in answer if a != 0])