You can probably guess what your homework is. So we know that an 8th order polynomial isn't very useful. Can you do better? So I want you to go back through our example, and use different values for the degree polynomial that you're going to use to fit. Change that 8 to different values and see if you can figure out what degree polynomial actually scores best using train/test as a metric. Where do you get your best r-squared score for your test data? What degree fits here? Go play with that. It should be a pretty easy exercise and a very enlightening one for you as well.
So that's train/test in action, a very important technique to have under your belt, and you're going to use it over and over again to make sure that your results are a good fit for the model that you have, and that your results are a good predictor of unseen values. It's a great way to prevent overfitting when you're doing your modeling.