← 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"))
- A.PAN ABCDE1234F, roll CS2024
- B.[PAN] [PAN], roll CS2024
- C.PAN [PAN], roll [PAN]
- 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 →