Added comments to explain the logic.
Adjusted the formatting to adhere to a consistent style for Python. Used clearer variable names.
Combined the tree node creation and assignment in a more compact way. Moved the example usage to the end for better readability.
Added comments to explain the logic. Adjusted the formatting to adhere to a consistent style for Python. Used clearer variable names. Combined the tree node creation and assignment in a more compact way. Moved the example usage to the end for better readability.