Found a great site a few days ago for learning to code, kind of. Although the site does not actually teach you to code and give you code examples, etc.
What it does do is set you a series of exercises and then adds some code to test that your answer to the exercise is correct. It lets you submit your answer to the site, and then see other people’s submissions in order to compare, and work out how you could improve your code.
You can find it at exercism.io