Correction:- You can check the existence of a key in a dictionary directly using in-operator: key_name in dict_var.
```
def is_valid_parentheses(s):
stack = []
brackets = {"(": ")", "[": "]", "{": "}"}
for char in s:
if char in brackets:
stack.append(brackets[char])
elif not stack or char != stack.pop():
return False
return len(stack) == 0
``
#python #pythonprogramming #parentheses `