Practice mode Python

In which Python version was the match statement for structural pattern matching introduced?

Correct answer B. Python 3.10

Explanation

Structural pattern matching, using the match and case soft keywords, arrived in Python 3.10 through PEPs 634, 635 and 636. It compares a subject against patterns that can destructure sequences, mappings and objects, which makes it far more powerful than a simple switch statement.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.