I make things like this for product trainings with my company using a graphical tool (Articulate Storyline), and I think your idea and execution are both quite good.
Check out the book "ELearning and the Science of Instruction" for research-based tips on fine-tuning things you're doing.
At first glance, the visual indicators (code or box highlights) are really important and a little understated. I would make them more prominent visually.
Secondly, I would think about feedback on incorrect answers as well as hints. E.g., on section 1.1, the user may feel stuck without a clear memory of how to write Hello class. Allowing for something like "show me the next line" to get started would help learners who need more support.