programmers - 올바른괄호[level2] - python

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
def solution(s):
    lst =[]
    if s.count('('== s.count(')'and s[0== '(' and s[-1== ')':
        for i in range(0len(s)):
            if s[i] == '(':
                lst.append('(')
            elif s[i] == ')':
                try:
                    lst.pop()
                except:
                    print('except')
                    return False
    else:
        return False
    return True
cs


  • 네이버 블로그 공유
  • 네이버 밴드 공유
  • 페이스북 공유
  • 카카오스토리 공유