If you were to start learning to code today, where would you begin? I started learning Python 7 years ago while working as a data analyst. It took me at least 3 years to feel confident in my skills.
But today, things are very different. You can reach an intermediate level in Python in just 3 months or less if you learn it the right way. In this video, I'm going to show you exactly how I would learn Python if I were starting from scratch today.
Before we dive in, let's address the elephant in the room. Is it still worth learning Python in the age of artificial intelligence? What's the point when AI can write code much faster than we can?
Well, Python is still one of the most in-demand programming languages today. In addition, knowing how to program in Python empowers you to build applications on top of AI models. This means you're not just a consumer of AI, but you can build things with it. Yes, AI can now generate code, making coding more accessible with no-code and low-code tools, but it still has significant limitations that we can't ignore. Hallucination in a conversation may be amusing and insignificant, but in coding, it can be fatal.
A cybersecurity researcher recently noticed that large language models repeatedly produced a command to install a non-existent Python package. Without sufficient understanding, you might unknowingly allow AI-generated code to install malware in your environment. That's why you still need to know how to code even if you use AI to write code. Being proficient in Python will help you verify and correct AI generated code and leverage AI effectively and safely.
Programming is about logical thinking and using that creatively to create a set of instructions. And it helps that Python mostly looks like plain English. Even if you don't know how to code, you can sort of read it. I wish I wouldn't worry too much about choosing a development environment to use when I first started. But anyway...
Choosing the right one might make your life a little bit easier. Which development environment to choose depends on your goal. Do you want to learn Python to become a developer?
Or do you want to learn it to do data analysis and machine learning or AI? And you can also choose between a local code editor and a hosted service. At the very beginning, you may not want to bother with installing Python and setting an environment yourself. So you can use an online code editor such as Replit, where you can start writing code right away in an online environment. For data science and machine learning specifically, a common tool is Jupyter Notebook, which allows you to run blocks of code individually and inspect results.
An online version of Jupyter Notebook is Google Collab, which is a hosted Jupyter Notebook service. It requires no setup to use and provides free access to some computing resources. which is pretty neat if you have a small project and you want to collaborate with others in real time. However, in the long run, it's best to install Python in your computer so you can use it locally.
Then you can use Python directly in your terminal. Try using it as a calculator or print some fun joke in your terminal. The next step is to install an integrated development environment like Visual Studio Code or PyCharm. These are software that help you develop general applications and they make it easy to edit codes and have all the functionalities built in that you might need for your project, hence the name Integrated Development Environment. I used to use Jupyter Notebook a lot for my data science project in Python, but nowadays I find it easier to use Jupyter Notebook inside Visual Studio Code, as I can easily use GitHub Copilot, which we'll talk about later in this video.
Once you decide which tool to use, you can immediately start learning the basics, like variables, data types, and functions, you really want to know the basics of control flows like conditional statements and loops, don't get carried away. A lot of times we get stuck in the details of some small topics and lose motivation, and we want to avoid that. To help you visualize what you may want to learn at each stage of learning Python, I decided to create this mind map for learning Python. If you laid out every single Python concept in a mind map, this is basically what it would look like.
You can see on this mind map I divide the topics into basic, intermediate, and advanced. As you can imagine, the basic topics include the integrated development environment for Python, how to install and manage packages, working directory, and all things basic, just in any programming languages such as data types, variables, functions, operators, conditional statements, and loop statements. It's fine not to completely understand everything at this stage.
You have the chance to practice and solidify your knowledge in the next levels. Moving on to the intermediate topics, where you can start doing really useful things. On this level, you should learn more advanced things like working with different types of files, version control with Git, Python for data science aka doing data analysis and machine learning with Python, object-oriented programming, decorators, debugging, and error handling. At this stage, you also want to pay attention to good coding practices, meaning writing clean, readable, and and efficient code.
There's a distinction between writing code for a personal toy project and building something in the real world. Some of the most important good coding practices may include follow the style guide for Python code and be consistent with it. Use meaningful variable names.
Trust me, naming variables is one of the hardest thing in programming. Avoid hard coding numbers in your code because no one would be able to understand what these numbers represent except yourself. Use list comprehensions and generators when necessary instead of using for loops.
Also add error handling in your code. Provide commenting and documentation in your code. Use virtual environments to encapsulate packages for separate projects.
If necessary, you also want to create unit tests for your functions. At this stage, there could be a lot of things to learn, so I'd recommend you start thinking about what you want to focus on. For example, if you're learning Python for data science, machine learning, and AI, you know that you need to master all the basics, plus some of the most basic Python packages you need to use for working with data such as NumPy, Pandas, Matplotlib, Seaborn, and Scikit-learn. While if you want to learn to become a data engineer or software engineer, then object-oriented programming, decorators, and learn to write efficient and clean code are even more important. Once you've moved on to the more advanced topics, you can start building more complex applications.
And you can start learning how to use an API for your application, develop a web application with a user interface, or a complex game, and so on. This is also where you start moving from building prototypes in Jupyter Notebooks to building an user-friendly application. In Python, there are a lot of popular frameworks that make it easier for you to develop a web app.
For example, Django and Flask. You'll also learn how to deploy your application on a cloud hosting platform. If you want to learn advanced programming and develop complex applications, I'd like to shout out to CodeCrafters, who has kindly sponsored this video.
CodeCrafters is a learning platform to help engineers get really good at their craft. Build your own Redis, Git, Docker, SQLite from scratch just for fun. They also have a separate Python track where you can learn to use Python to create your own software.
This platform targets senior programmers who want to build tools and master their skills. If this sounds interesting to you, check out CodeCrafters in the description below. Alright, you can use this mind map as a useful reference for knowing what is what in Python and building your own learning curriculum based on your goals and your needs.
After that, you can start looking up some tutorials on YouTube or signing up for an online Python course and go through the concepts you want to learn. I've also linked this mind map in the video description below, so feel free to check it out and explore it. This overview is just a guidance.
The best way to actually learn something, though, is through doing. And the best way to actually own your knowledge is through teaching. Let me explain. Most of us learn like this.
You learn something and then move on to the next thing and then move on to the next next thing. By the time you move on to the fourth or the fifth thing, you already forget the previous things you learned. Sounds familiar? This is not because you're stupid.
It is because if you learn something without immediately applying it, your brain would get a signal saying, oh this thing is apparently not important because I never need to use it for anything. So a better way to learn Python or any foreign languages is to immediately put what you've learned into practice and start creating something useful with it. This something doesn't need to be too useful.
For example, you just learn about Python functions, you can create a function to calculate your BMI. If you need some ideas, you can simply go to ChatGPT and ask it to create a quiz or practice problem for you. At this point, you might think, okay, cool, I can move on to the next thing.
Or you might decide to go to the next level, which is to teach others what you've learned. I love writing blog posts and tutorials or making videos to explain concepts I just learned. In fact, I believe you should always teach what you learn.
By teaching, you learn it more deeply, and it helps reveal gaps in your knowledge that you would otherwise never know. It's said that no one learns as much about a subject as one who is forced to teach it. So for me, the best formula to learn coding is actually learn, do, teach, learn, do, teach, and so on.
This is easier said than done. Almost all of us experience some sort of dip in confidence and motivation while picking up a new skill, and coding is no exception. You get started feeling very excited, learning about how to print hello world and make the first for loop to count from 1 to 10, you feel like you are crushing it and becoming a guru very soon. But this is just an illusion.
This is called the Dunning-Kroger effect in psychology, which basically means the incompetent people usually overestimate their own abilities. After one or two weeks, you start feeling overwhelmed and realize how little you actually know about programming. You want to learn Python to do machine learning?
But you just realize that you also need to learn math, statistics, and some computer sciences stuff at the same time. And this is completely normal. Unfortunately, 99% of people give up at this stage. They cannot push themselves to step up and keep going, even when they don't feel like doing it.
If you can't go past this stage, then you'll forever be a beginner. And the problem is... in today's world, being a beginner, you're less competent than ChatGPT. So all you need to do is to trust the process.
For me, the best way to get out of the valley of despair is to learn with a purpose. You want to find a problem that you want to solve and create a personal project that solves it. This will help shift your focus from I'm incompetent to I'm learning what it takes to solve a real-life problem.
You might be asking, but I'm still just a beginner. I don't know where to start. A good thing to note is that your project doesn't need to be complicated at all. It doesn't need to change the world.
It just needs to be a little bit useful. One of my projects is to take all the books from the Witcher book series to create a network of characters in the story. It is useful, but not too useful.
It was fun and doable, and there were a lot of new ideas and concepts thrown at me, and that's the point. When you get absorbed in your project, you're just too excited to stop. There were quite a few weekends when I coded until wee hours. just to see if something actually works and my project slowly coming to life. I think there's no better source of motivation than this.
You'll also come across many similar projects from other people. You can then reverse engineer what they have done to tackle the same challenges in the project, and this will help you build your own problem-solving skills. In addition, in the age of AI tools today, you no longer have to do projects all by yourself.
Nowadays, I often use GitHub Copilot to help me write code faster and less error-prone. In data science, this really helps you focus more on the idea and the creative process behind it, rather than getting bogged down with fixing the data types or adjusting axis on a chart. Believe me, this can cost a lot of time.
And by the way, I'm currently working on a course on Python for data science and AI project. If you're interested, check out the link below to be the first to hear about it when it's available. Thank you for watching. Bye bye!