I would like my output to be only words in parentheses inside the string without using regex.
Code:
def parentheses(s):
return s.split()
print(parentheses("Inside a (space?)"))
print(parentheses("To see (here) but color"))
print(parentheses("Very ( good (code"))
Output:
['Inside', 'a', '(space?)'] -> **space?** ['To', 'see', '(here)', 'but', 'color'] -> **here** ['Very', '(', 'good', '(code'] -> **empty**