Vidyalelo
Python · Q37

Regular Expressions in Python

Programming · Python · question 37

Q37

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.groupdict())

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

Answer: Option A

Solution

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