Tesla interview question

Python related code challenges about state machine and tree data structures