강의로 돌아가기

### 테이스 케이스 실패...조언부탁드립니다.

테스트 케이스 5,6,7,10에서 실패뜨는데 혹시 조언해주실분 계실까요?

###### 작성중인 코드―solution.py
``````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
42
43
44
45
46
47
48
49
import itertools

baseball = [
[123, 1, 1],
[356, 1, 0],
[327, 2, 0],
[489, 0, 1]
]

def strike_ball(ans_list, numbers, strike, ball):
counted_all = []
for i in range(len(ans_list)):
counted = set()
s_cnt = 0
b_cnt = 0

for j in range(3):
if ans_list[i][j] in numbers:
if ans_list[i][j] == numbers[j]:
s_cnt += 1
else:
b_cnt += 1
if s_cnt == strike and b_cnt == ball:

counted_all.append(list(counted))

counted_all = [y for x in counted_all for y in x]

return counted_all

def solution(baseball):
ans_list = []
permu = list(itertools.permutations(range(1, 10), 3))

for p in permu:
ans_list.append(''.join(str(e) for e in p))

for baseb in baseball:
numbers, strike, ball = baseb[0], baseb[1], baseb[2]
numbers = str(numbers)
ans_list = strike_ball(ans_list, numbers, strike, ball)

return len(ans_list)

print(solution(baseball))
``````