Skip to content

Instantly share code, notes, and snippets.

@KatUser
Created July 14, 2020 08:37
Show Gist options
  • Save KatUser/5a93de6c52d68ed0f18ca6bc8bb4497b to your computer and use it in GitHub Desktop.
Save KatUser/5a93de6c52d68ed0f18ca6bc8bb4497b to your computer and use it in GitHub Desktop.
Brackets
def is_correct_bracket(text):
a = ''
while True:
a = text
text = text.replace('()', '')
if len(text.replace('()', '')) == len(a):
break
if len(text) == 0:
return True
else:
return False
txt = input()
# вызываем функцию
print(is_correct_bracket(txt))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment