To learn programming, the best way is to go through a structured route.
Try hackerrank.com
Try leetcode.com
The basic tasks to learn any language.
How to output information (such as print screen, the classic ‘hello world’)
How to input information (read a csv, or take in keyboard input)
Storing data in memory, such as variable storage.
Controlling program flow, if/then statements, and loops.
For AI and Machine Learning, the slightly different paradigm is to understand matrices (also known as tensors), some linear algebra, and statistics.