Telegram Group & Telegram Channel
Solution:

def BalancedBrackets(st):
openingBrackets="([{"
closingBrackets=")]}"
matchingBrackets={ ')':'(',
'}':'{',
']':'[' }
stack=[]
for char in st:
if char in openingBrackets:
stack.append(char)
elif char in closingBrackets:
if len(stack)==0:
return False
if stack[-1]==matchingBrackets[char]:
stack.pop()
else:
return False
return len(stack)==0
print(BalancedBrackets(input()))

Share and Support @python_codes



tg-me.com/python_codes/129
Create:
Last Update:

Solution:

def BalancedBrackets(st):
openingBrackets="([{"
closingBrackets=")]}"
matchingBrackets={ ')':'(',
'}':'{',
']':'[' }
stack=[]
for char in st:
if char in openingBrackets:
stack.append(char)
elif char in closingBrackets:
if len(stack)==0:
return False
if stack[-1]==matchingBrackets[char]:
stack.pop()
else:
return False
return len(stack)==0
print(BalancedBrackets(input()))

Share and Support @python_codes

BY Python Codes


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/python_codes/129

View MORE
Open in Telegram


Python Codes Telegram | DID YOU KNOW?

Date: |

The messaging service and social-media platform owes creditors roughly $700 million by the end of April, according to people briefed on the company’s plans and loan documents viewed by The Wall Street Journal. At the same time, Telegram Group Inc. must cover rising equipment and bandwidth expenses because of its rapid growth, despite going years without attempting to generate revenue.

Python Codes from ca


Telegram Python Codes
FROM USA