Write many small programs as often as you can. That is, write new programs often, and make them small so you learn the full cycle of beginning, middle and end, over and over. This is the best way to learn.
Learning programming consists of 3 main things (imo):
1) The problem:
Learning to break a problem down and solve it in individual steps.
eg. Fill Car With Gas:
Turn Engine off
Open fuel cap
Get out of car
walk to fuel pump
etc etc
This is fundamentally what you will end up telling the computer to do when you write code, breaking a big problem into smaller problems, and smaller problems into individual steps.
Sometimes before writing a program, we will do the steps manually ourselves first to understand them. Then you write the code.
Its like when telling your friend how to do something its much simpler when you've done it yourself before.
2) The Machine:
When you're first learning its not required to worry about the actual machine the computer is doing. Just to note a few quick things.
The computer can really only do a few very simple things, almost everything the computer does is literally just combinations of the following very simple things:
INPUT - Read a number from somewhere (from memory, from disk, from network, from a previous step)
OPERATION - Do something with the number (add, subtract, multiply, compare etc)
OUTPUT - Write a number somewhere (to the display, to memory, disk, network, to a subsequent step)
Do combinations of any of the above IF some thing is true (eg. number is bigger than 10)
3) The Language(s):
To tell our computer friend the steps we want it to do, we need to use a language it understands. Don't get hung up on languages, in the end most of them have alot of similarities, and learning the core concepts is more important than memorising specific syntax.
To say this another way, while syntax is important to USE a language, it doesn't always have a huge bearing on the core concepts underneath. A classic beginner mistake is muddling the language vs the core computing concepts.
In the end, almost whatever code you write, no matter the language, it ends up doing a combination of those simple steps from #2.
The job of the language is to make it easy and efficient for a human to tell the computer which combinations of those steps from #2 we want the computer to do to achieve our task. And if the language has done its job, it will hide many of those tiny steps from us, so we can worry about the main steps which relate to our problem.
Re. first language choice, python is probably a good starting point, since if you use it properly it's often almost like writing in english to the computer. In the end it doesn't matter so much as sticking with it, practicing and slowly learning the core concepts. In general any user friendly high level language will have an easy learning curve, Python, Javascript etc.
General Tips:
Learn some basic debugging & troubleshooting methods, at first this might just be displaying numbers during calculation steps to check the computer is doing what it should be doing, and then slowly move to more sophisticated methods. Along with basic commenting etiquette etc.
Avoid stackoverflow like the plague. There is some good discussion there, but if you want to actually learn, you need understanding. And copy/pasting someone else's code will not give you this.
Same goes for chatgpt coding, autopilot etc.
When googling deliberately search for the official manual/documentation, or even a tutorial is fine if it's unfamiliar or the official docs aren't easy for you to understand, but absolutely avoid pre-cooked answers on stackoverflow etc as google will also push them on you when googling programming stuff.
The only exception is if you're absolutely stuck, when doing learning exercises it's ok to view someone else's answer as a 'solution', but IMPORTANTLY, do not move forward until you have understood at least 90% of how and WHY they did it. Without that understanding you're wasting your time, and sometimes you will even find mistakes in those answers, so blindly copying is only hurting you.
Get onto IRC (or matrix, discord whatever), and TALK with other programmers. Don't go running to someone every time you stumble, but you can learn ALOT from others when you put in the right amount of groundwork and sometimes you will learn just by seeing other people solving their own problems.
Take it as slowly as you need, there's a lot to learn and it can either be daunting or easy to rush ahead without fully understanding.
Practice as much as you can. Videos and tutorials are good for gaining an understanding but nothing beats solving actual problems and writing code. Try to do a little everyday and more when you can.
It's free for individuals and teaches all the popular languages (Python, Java, C++, etc.). Figure out what language will be most useful to the kinds of programs you wanna build (website, game, etc.) and start with the beginner courses. Once you get the hang of it, you can look up how to run a local development environment on your computer for the language of your choice so you can start building applications for real.
Its a 30/70 thing. You spend 30℅ of your time programming and 70% of your time trying to figure out why your program doesn't run right. There are plenty of resources out there with different ways of teaching the same thing so take in as much as you can even if it's on something you feel like you got down.
I bought a Udemy course for python, and then immediately came up with a project (writing a telegram bot). I learn best when I have a project to try new concepts on. If i'm not building, I'm not learning.
It is very hard to learn on your own. You will have problems that are completely new to you. Luckily most of these problems have ready been saved by someone, google and chatGPT is your friend.
Try out this website: phind.com
It is a search engine optimised for programmers.
chat gpt isn't very good at coding but it is pretty good at documenting functions and suggesting possible improvements, making things more idiomatic, giving you a quick run down on how to use a library, stuff like that. just gotta keep in mind that it lies to you with 100% confidence sometimes