Medium Decision Tree Python Code