How Long Does it Take to Learn Python?


How Long Does it Take to Learn Python?

More than 15 years ago, when I first started learning to code, the first programming language I studied was Python. Python is extremely beginner-friendly, it has a simple and clean syntax and it encourages good coding practices. But approximately how long does it take learn it?

Python is one of the easiest programming languages to pick up: you can learn the basics in 4-8 weeks, even if you have no programming experience. However, to get to the level where you can get a job as a junior python developer you’ll probably need at least 3-6 month.

In this article I’ll give you some tips on how to speed up the learning process, and also point out some of the caveats that can potentially hinder your progress.

1. If You Learn Something, Put It Into Practice Immediately

This tip is the most important one on this list. Learning to code in any language is a skill, that you can only master by practicing.

You would never start learning a foreign language by memorizing the whole dictionary from A to Z, right? It’s exactly the same with programming languages. It is more important to learn the logic of the language and have in your head the “recipes” for solving common problems, than being flawless with the syntax and learning the exact signature of every builtin function. Modern editors and IDEs have code completion and syntax highlighting that will help you out there, so do not waste too much time on it.

2. Learn Idiomatic Python

Python developers like to think in so-called idioms - small, easy-to-understand, expressive snippets of code. Most common coding problems can be solved in a number of different ways, but Python’s design philosophy is that there should preferably be one single, obvious way to do it. Sometimes this is referred to as the Pythonic way.

As a simple example to show you what I mean, let’s say you want to generate all the odd numbers from 0 to 100. You could do something like:

odd_numbers = []
i = 0
while True:
    i = i + 1
    if i % 2:
        odd_numbers.append(i)
    if i==100:
        break

But there is a much simpler way to do it by Python’s awesome list comprehension feature:

odd_numbers = [i for i in range(100) if i % 2]

This is something that you could call a Python idiom. As you can see this is much shorter, therefore easier to read, and less likely to contain bugs. Also, under the hood it is more effective, so your Python code will also have a tendency to run faster if you use the correct idioms.

If you want to learn more, here’s a great video of Python core developer Raymond Hettinger talking about beautiful, idiomatic Python. (You should also check out his twitter, he regularly shares some nice bits of programming wisdom)

3. Play Around With Code Challenges

In my opinion code challenges are a great way to learn a new language. If you are already familiar with the very basics, you can jump in and earn some practical experience, as there are a lot of fun challenges aimed at beginners.

The harder challenges tend to be somewhat similar to coding questions that come up on job interviews, so it’s a great tool to get you prepared for that as well.

Gamification is another great aspect of online code challenge platforms, leader boards, leveling up can help making the learning process fun, and can keep you motivated.

My favourite coding challenge platform is CodeWars, it has a huge archive of challenges for more than 20 languages. It also has great social features and an awesome community. One feature I am particularly fond of is that you can see other peoples’ solutions for the challenges. The solutions can be voted for ‘best’ and ‘smartest’, which makes it a great tool for learning idioms or clever hacks that you’d never find in a programming book or course.

Another fun challenge is the yearly Advent Of Code event. It is held in every december, where programmers around the world aim to solve a series of challenges for 4 weeks. The first few challenges are quite easy, but get progressively harder until Christmas.

If you are looking for an offline resource I’d absolutely recommend Cracking the Coding Interview. This is not a Python-specific book, but it’s the number one resource if you need help with preparing for a job interview.

4. Solve Real World Problems

Algorithmic problems and code challenges are fun, and can be helpful on interviews, but let’s be honest, chances are, during your 9 to 5 job, you won’t get paid for generating fibonacci sequences or solving the Knapsack Problem over and over. Programming is about solving real problems, so the best way to get better at it is doing just that.

Python is a wonderful tool for automation, there are a lot of great opportunities to practice that: look for things where a little script or app can make your life easier. It can be home automation, keeping track of your budget, or organizing your family photos or music library.

5. Learn To Use An IDE

It is not a Python-specific thing, but mastering a modern text editor or an Integrated Developmnet Environment (IDE) is crucial part of becoming a developer. It is often neglected in programming books and courses as it is not something that you’ll get asked on a coding interview or a school exam, but trust me, it’s important! Today’s code editors are so powerful, they can really boost your productivity, or help you out by filling the gaps in your knowledge regarding the language’s syntax.

Of course, in the very beginning, you can start off with using the command line, or an online interpreter, but you won’t be able to do any meaningful work without a proper editor.

You can choose any editor you like, I usually stick with PyCharm or vim, but you should be fine with any popular IDE or text editor. If you need help choosing, check out this article I wrote about IDEs.

6. Learn At Least One Framework/Library

Python is a great language, but chances are you won’t be building projects from the ground using plain Python. Most likely you’ll be using some kind of framework or library to build on. Which one? Well, it depends on your goals:

  • If you’re planning to build web applications, you should probably check out Django, or Flask
  • If data science is your thing, you should look into pandas
  • If you’re pursuing an academic career, or interested in scientific computations, then numpy is a great next step
  • For scientific visualizations, check matplotlib
  • If you want to learn more about machine learning, go ahead and take a stab at SciKit or PyTorch
  • And last but not least for computer vision projects OpenCV is worth a try

7. Learn To Navigate Large Code Bases

There’s a huge difference between tweaking your own little project, that you created last week, and finding an elusive bug in a decade-old project with hundreds of contributors. It is a skill that you won’t learn from any book or bootcamp. How to practice it then? This brings us to the last tip:

8. Contribute To Open Source

This is where things start to get real. The best way to hone your programming skills is to start contributing to real projects. It will also teach you the necessary collaboration skill like working with issue and bug trackers, code versioning systems, etc.

Plus it’s a wonderful way to give back to the community! If you want to go down this road, check out firsttimersonly.com - it’s a great collection of links that will help you get started.

Summary

To sum it up Python is a great choice for beginners, very easy to learn. With the proper approach you’ll be able to write small working snippets on day one, take a stab at some fun algorithmic challenges after in 1-2 weeks, solve smaller real-world problems in a month, and hopefully competent enough to get an entry-level job after 3-6 months.

References