mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-07 03:07:46 +08:00
Make some ruff fixes (#8154)
* Make some ruff fixes * Undo manual fix * Undo manual fix * Updates from ruff=0.0.251
This commit is contained in:
@ -24,11 +24,10 @@ def is_balanced(s):
|
||||
if s[i] in open_brackets:
|
||||
stack.append(s[i])
|
||||
|
||||
elif s[i] in closed_brackets:
|
||||
if len(stack) == 0 or (
|
||||
len(stack) > 0 and open_to_closed[stack.pop()] != s[i]
|
||||
):
|
||||
return False
|
||||
elif s[i] in closed_brackets and (
|
||||
len(stack) == 0 or (len(stack) > 0 and open_to_closed[stack.pop()] != s[i])
|
||||
):
|
||||
return False
|
||||
|
||||
return len(stack) == 0
|
||||
|
||||
|
Reference in New Issue
Block a user