I'm trying to write a program that asks the user for a string input without using global variables. If the string has parentheses only side by side, then it's even. if it has letters, numbers, or the parentheses are spaced out, then it's uneven. For example, () and ()() is even, whereas (() and (pie) is not. Below is what I've written so far. Do I have to create more than one function for this problem?
def recursion():
string = str(input("Enter your string: "))
if string == "(" or ")":
print("The string is even.")
else:
print("The string is not even.")