Answer:
import regex as re
def in_parentheses(a_string):
regeX = re.compile(".*?\((.*?)\)")
result = re.findall(regeX, a_string)
return str(result).replace("[","").replace("]","")
print("test 1: "+in_parentheses("Open ( only"))
print("test 2: "+in_parentheses("This is a sentence (words!)."))
By looking at your code, it seems like you're trying to let the user enter positive numbers until the user enters a negative number. To achieve this, you need to indent int(input("Enter a number, negative to stop")) inside the loop.
The second answer choice is correct.