Created
July 14, 2020 08:37
-
-
Save KatUser/5a93de6c52d68ed0f18ca6bc8bb4497b to your computer and use it in GitHub Desktop.
Brackets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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