0

Need help (сбалансированные скобки)

def balanced(expression): a=0 b=0 for i in expression: if i == '(': a+=1 b+=2 elif i == ')': a-=1 b+=2 if a == 0 and b!=0: return True else: return False print(balanced(input())) 7 test can't get agree

21st Jun 2022, 4:56 PM
Алексей Дерябин
2 Answers
+ 1
Reverso Context balance (data structure)
21st Jun 2022, 5:14 PM
Алексей Дерябин
0
What is this code's objective?
21st Jun 2022, 5:08 PM
Justice
Justice - avatar