Yes, but the alternative (which used to be the case until you ran the tests) is that you don’t show what is expected for the tests. For simple exercises, yes this means you can code to the test to pass.
But for the harder exercises it means you can see what the expected output should be, and that is often more important; the description and examples alone are often not enough. You know what the data looks like going in, and you want to know what it should look like coming out: the challenge is writing the logic in-between, the test cases don’t help you with that.
Plus sure, you can just return exactly what the test requires and pass everything that way, but what’s the point?