The problem with learning to code is that you think you know everything until you get hit with real world problems, and then all the shit you learned applies but in a different (troubleshooting/problem solving) angle.
If you are in a first world country, it is not that hard to get a job as a coder or some sort of analyst if you are proficient with a programming language. You just need to move to a big city, there is shortage of technical talent everywhere and companies will hire people with a certain skillset and no experience, usually as contractors to work on a project for a period of time. A lot of the times these positions become permanent as well. When you are in a role like that and do that shit everyday in a real world scenario, you start getting really good at it.
Once you are GOOD at it, that is when you can freelance and get paid imo. It is still possible otherwise, but it will be an uphill battle, because more experienced developers/coders are also moonlighting as freelancers, and that is your competition.