To code a decision tree up from scratch, check out the Decision Trees project course. There you'll get to use them with subway arrival and departure times to optimize your commute.
You can also read this account in the form of a blog post.
Also, feel free to refer to
the slides and
the Python code
for your study and teaching.