Problem Bank for Practice Problems and Test Problems¶
Match a character that is one of ^, a, b, or c.
Match a character that is not one of ^, a, b, or c.
Match a character that is not one of a, b, or c.
Match 3 characters in the sequence of “abc”.
11-9-1: What does [^abc]
mean?
Before you keep reading...
Making great stuff takes time and $$. If you appreciate the book you are reading now and want to keep quality materials free for other students please consider a donation to Runestone Academy. We ask that you consider a $10 donation, but if you can give more thats great, if $10 is too much for your budget we would be happy with whatever you can afford as a show of support.
Matches any digit (0, 1, …, 9).
Matches any date (yyyy-mm-dd).
Matches a dash.
Matches a dot.
I don’t know.
11-9-2: What does the pattern \d
match?
[abc]
(abc)
(?abc)
(?:abc)
I don’t know.
11-9-3: Which one of the following patterns should I use to treat “abc” as a group for repeating, but not make re.findall only return the content in the group?
Any lowercase letter
-
It matches more than this
Any lowercase or uppercase letter
-
It matches more than this
Any lowercase or uppercase letter, or underscore
-
It matches more than this
Any lowercase or uppercase letter, or underscore, or digit from 0-9
-
It matches any lowercase or uppercase letter, or underscore, or digit from 0-9
I don’t know.
-
That is okay
11-9-4: Which of the following best describes what \w
matches?
(?:A+B)+A+
(?:A+B)*A+
(?:AB)+A+
(?:A*B)+A+
I don’t know.
11-9-5: Which of the following patterns would match “A”s separated by individual “B”s in between, for example, “AAABAABAA”, “ABAAA”? Note that “B” should not appear consecutively, and should not appear as the first or last character. B must appear at least once.
attend|ee
attend(ee){1,}
attend(?:ee)?
attend[ee]
I don’t know.
11-9-6: Which of the following would match both words “attend” and “attendee”?