There are several ways to learn programming, from reading books to watching video tutorials to just sit down and try, trial and error style.
There is also games. Games that will teach you programming and here are some of them.
Human resource machine is a game where you control office workers to solve different puzzles in a very algorithmic way. taking you from a noob to a pro in no time.
7 Billion Humans is the follow up to the popular Human resource machine where you automate swarms of people to solve puzzles in a parallel computer made of humans.
Hack ‘n’ Slash with it’s super awkward 80s inspired trailer is a puzzle action game where you need to hack the world around you. Hack the objects of the world, change their data and behaviour.
TIS-100 is a game where you design electronic devices to solve open-ended puzzles by rewriting corrupted code segments in assembly.
Shenzhen I/O is a spiritual sequal to TIS-100 where you build circuits and program them with the assembly language.
while True: learn() is a game where you use visual programming to develop machine learning algorithms with your cat.
Exapunks is a game where you solve open-ednded puzzles by programming viruses and hacking everything hackable.