Examveda

What is the output of the following code:
import re
pattern = re.compile(r'(d+)s(w+)')
result = pattern.findall('There are 5 apples and 3 oranges.')
print(result)

A. [('5', 'apples'), ('3', 'oranges')]

B. An error will occur

C. [('5', 'and'), ('3', 'and')]

D. [('5', '3'), ('apples', 'oranges')]

Answer: Option A


This Question Belongs to Python Program >> Regular Expressions In Python

Join The Discussion

Related Questions on Regular Expressions in Python