Code Kata8

def is_valid(string):
	a = '()'
    b = '{}'
    c = '[]'
    while string:
		if a in string : 
        string = string.replace(a, '')
		elif b in string : 
        string = string.replace(b, '')
		elif c in string : 
        string = string.replace(c, '')
        	else:
        	return False
	return True

좋은 웹페이지 즐겨찾기