Question

Consider the following Python code: import re text = "apple, banana, cherry. apple pie, banana split." pattern = r"\bapple\b|\bbanana\b" matches = re.findall(pattern, text) print(matches) What will be the output of this code?

A ['apple', 'banana', 'apple', 'banana']
B ['apple', 'banana', 'cherry', 'apple', 'banana']
C ['apple', 'banana']
D ['apple', 'banana', 'apple pie', 'banana split']
E ['apple', 'banana', 'apple', 'banana', 'split']
Practice Next

Hey! Ask a query

🎓
Think You're Ready for RBI Grade B?
RBI Grade B 2026 Phase 1 Memory Based Paper
  • 200 Questions with Detailed Solutions
  • Section-wise Coverage (GA, English, Quant & Reasoning)