The reverse function is an excellent solution, but for a fun exercise you might want to know how to do that without the built-in reverse function.