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

Quiz: Git Config, .gitignore and Hooks · Question 8 of 10

What does this print? (code)

What does this print?

import re

PATTERN = re.compile(r"^(feat|fix|docs)(\([a-z-]+\))?: .{3,72}$")
for m in ["docs: update README", "feat(cart) add coupon", "fix(api): handle 404"]:
    print(bool(PATTERN.match(m)), end=" ")
  1. A.True True True
  2. B.True False False
  3. C.True False True
  4. D.False False True
Answer & explanation

Correct answer: True False True

The second message is missing the colon after (cart), so it does not match.

Can you get the rest right without peeking?

Take the timed Quiz: Git Config, .gitignore and Hooks quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →