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!)."))
3.4 lesson practice quiz edhesive
:
Write a program to check if user inputs "yellow"
Answer:
In Python:
col = input("Enter Color: ")
if col == "yellow":
print("True")
else:
print("False")
Explanation:
This prompts the user for color
col = input("Enter Color: ")
This checks if color is yellow
if col == "yellow":
If true, this prints true
print("True")
If otherwise, this prints false
else:
print("False")
C. Both serially and Perullo