(tree, value)
| 182 | |
| 183 | print("Example 12") |
| 184 | def contains(tree, value): |
| 185 | if not isinstance(tree, tuple): |
| 186 | return tree == value |
| 187 | |
| 188 | pivot, left, right = tree |
| 189 | |
| 190 | if value < pivot: |
| 191 | return contains(left, value) |
| 192 | elif value > pivot: |
| 193 | return contains(right, value) |
| 194 | else: |
| 195 | return value == pivot |
| 196 | |
| 197 | |
| 198 | print("Example 13") |