DoorDash Interview Question

Design a tree class in python that has many edge cases and create nodes from a string of nodes and given a value.