MCPcopy Index your code
hub / github.com/BeeBombshell/Python-DSA / verif_t

Function verif_t

DSA/Check Bracketing.py:12–29  ·  view source on GitHub ↗
(l)

Source from the content-addressed store, hash-verified

10
11
12def verif_t(l):
13 list_elem = []
14 for el in l:
15 if el == "(" or el =="[" or el =="{":
16 list_elem.append(el)
17 elif el==")" or el=="]" or el=="}":
18 if len(list_elem)!=0:
19 if el == ")" and list_elem[-1]=="(":
20 list_elem.pop()
21 elif el == "]" and list_elem[-1]=="[":
22 list_elem.pop()
23 elif el == "}" and list_elem[-1]=="{":
24 list_elem.pop()
25 else:
26 return False
27 else:
28 return False
29 return len(list_elem)==0
30
31
32if __name__ == '__main__':

Callers 1

mainFunction · 0.85

Calls 2

appendMethod · 0.80
popMethod · 0.80

Tested by

no test coverage detected