Vidyalelo
Python · Q88

Regular Expressions in Python

Programming · Python · question 88

Q88

What will be the output of the following Python code? sentence = 'horses are fast' regex = re.compile('(?P +) (?P +) (?P +)') matched = re.search(regex, sentence) print(matched.groups())

A.
{'animal': 'horses', 'verb': 'are', 'adjective': 'fast'}
B.
('horses', 'are', 'fast')
Answer
C.
'horses are fast'
D.
'are'

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board