Is doing this right (legal)?

I’m making a repo on github to keep code files and explanation derived from codecademy and fcc. See I want to know can I do it? I’m asking because I have used the code made by you but i have added explanation to the codes using comments. And i have only used code which is the part of the free courses. I’m new to github so i don’t know whether doing this is right or not.

Legality and code is a super confusing jungle to explore. I will say this about reposting code you’ve found in the wild - if you aren’t making money from doing so then you probably won’t have any issues.

So can I continue putting my code there? Or should I ask someone else too? I’ll ask this on stackexchange too. I just want to be sure.