(tree, value)
| 205 | |
| 206 | print("Example 14") |
| 207 | def contains_match(tree, value): |
| 208 | match tree: |
| 209 | case pivot, left, _ if value < pivot: |
| 210 | return contains_match(left, value) |
| 211 | case pivot, _, right if value > pivot: |
| 212 | return contains_match(right, value) |
| 213 | case (pivot, _, _) | pivot: |
| 214 | return pivot == value |
| 215 | |
| 216 | |
| 217 | assert contains_match(my_tree, 9) |