Yes, especially doing things that are useful to you. This can be something very small. Many years ago, I needed to list filenames in a folder. (I had no idea of the command line). I knew some basic Python and I figured out how to do this.
Or I wrote a flashcard quiz test game to prepare for my history test in school (Javascript and HTML).
Or I wrote a small program to find rar or zip files on my computer that have also been extracted and now take up approx. double the space on the disk (the extracted version and the archive are both there).
Or some animations in Javascript to understand things we learned in physics class (harmonic oscillation and similar things). Small projects like that.
Or a program with GUI where I plotted some function we learned in math class about, with sliders to control some parameters of the function and see how the plot changes instantly.
I liked it so much that I enrolled in university to study computer science and I really liked the uni courses too, because I already understood how programming things is helpful in everyday life, it wasn't a dry abstract thing that you build for its own sake.