I wish there is video lessons about software copyright guideline

I would like to know about software copyright and I wish there is one in codecademy users.
As I practice the codecademy lessons, I changed the values and post the coding on my personal blog with commenting, ‘The code structure is from codecademy lessons and I changed the values.’ I wonder if this is ok. I want to keep the software copyright rules. I don’t know which practice is ok and which one is not.

For example, I posted the following on my wordpress blog.

The structure of the code is from codecademy lesson. I changed the values for my practice.

function makeShoppingList(item1 = ‘soyMilk’, item2 = ‘tofu’, item3 = ‘cabbage’){
console.log( Remember to buy ${item1} );
console.log( Remember to buy ${item2} );
console.log( Remember to buy ${item3} );

That can be classed as “Fair Use” so long as attribution is given, including a link to the source page. It wouldn’t be infringement since it is not an uncited derivative of the original, only a citation with variation.

Bottom line, never copy verbatim and always give attribution to the IP owner, in this case, Codecademy.

Summaries of Fair Use Cases - Copyright Overview by Rich Stim - Stanford Copyright and Fair Use Center