Квиз по Python: Regular Expressions (re)

This Python quiz tests the re module and the regular expression syntax you use most. You will predict what findall, search, match, sub and split return, and learn to spot greedy patterns, missing raw strings and None results.

Средний 10 вопроса ~6 минуты Проходной балл: 80% Python 3.12

Выберите режим

Вы играете как гость: войдите, чтобы сохранить XP и серию.

Пример вопроса

Вопрос 1 из 10

What does this print?

import re

print(re.findall(r"\d+", "a1b22c333"))
Показать ответ

C. ['1', '22', '333'] \d+ matches one or more digits in a row, and findall returns every match as a string. Without the + you would get each digit separately.

Что проверяет этот квиз

  • search vs match vs fullmatch
  • findall with and without groups
  • Greedy vs lazy quantifiers
  • Groups and back-references in re.sub
  • Raw strings and checking for None

Частые вопросы

Нужен ли аккаунт?

Нет. Играть может любой. Войдите, чтобы сохранять XP, серию, значки и историю.

Какая версия Python?

Python 3.12. Каждый вопрос о выводе программы проверен запуском кода.

Можно пройти ещё раз?

Да. Лучший результат сохраняется, а вопросы и ответы каждый раз перемешиваются.