🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Safety and Responsibility: all 10 questions

Quiz: Safety and Responsibility · Question 8 of 10

What does this print? (code)

What does this print?

import re
print(re.sub(r"\b[A-Z]{5}\d{4}[A-Z]\b", "[PAN]", "PAN ABCDE1234F, roll CS2024"))
  1. A.PAN ABCDE1234F, roll CS2024
  2. B.[PAN] [PAN], roll CS2024
  3. C.PAN [PAN], roll [PAN]
  4. D.PAN [PAN], roll CS2024
Answer & explanation

Correct answer: PAN [PAN], roll CS2024

Only the 5-letters, 4-digits, 1-letter pattern matches.

Can you get the rest right without peeking?

Take the timed Quiz: Safety and Responsibility quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →