parse_command(parts) where parts is a list of strings representing a tokenized command. Match these shapes: ["quit"] -> "Exiting"; ["move", direction] -> f"Moving {direction}" for any direction value; ["add", x, y] -> the sum x + y (parts[1] and parts[2] are already integers in this case); anything else -> "Unknown command".parse_command(["quit"])
"Exiting"
Matches the single-element pattern.
parse_command(["move", "north"])
"Moving north"
Matches the two-element move pattern, capturing direction.
parse_command(["add", 2, 3])
5
Matches the three-element add pattern and sums the captured values.
parse_command(["jump"])
"Unknown command"
Does not match any known shape.
Use list patterns like `case ["move", direction]:` to both match shape and capture values.
Order matters: put the wildcard `case _:` last.