So you’ve heard about Python, but you aren’t sure if you should invest time learning it or not? Don’t worry; you aren’t alone! As the author of a book called The Self-Taught Programmer that teaches Python, and the creator of a Facebook group with fifty thousand self-taught programmers in it, I get this question a lot. In this article, I will help you answer common questions like, “Should I learn Python? Should I learn Python or Java? Should I learn Python or R?” and “Should I learn Python 2 or 3?”
What is Python
Python is a programming language created by Dutch programmer Guido van Rossum in the 1990s. He named it after the British comedy group Monty Python. His key insight was programmers read code more than they write it, so he set out to create the easiest to read programming language in the world.
Python is a general-purpose language, which means you can use it for just about anything. Some of the biggest companies in the world use it, like Netflix and Google. NASA also uses Python when they are programming their equipment. Tesla uses Python as well, and legendary self-taught programmer Elon Musk even tweeted the following about it:
Of course, you shouldn’t use a programming language just because Elon Musk likes it. Keep reading to find out if it is the right choice for you.
Why Learn Python
There are three reasons why you should learn Python that I covered in my keynote speech, Why Python Is Eating the World at PyCon Japan.
The three reasons are because it is the best programming language for new programmers, there is a huge demand for Python programmers, and it has a unique community that is fun to be a part of.
The Best Language For New Programmers
Python is a fantastic choice for new programmers because of its readability.
When you are teaching someone to code; traditionally, the first program you teach them is how to print “Hello, World!” Here is how to print “Hello, World!” in Java:
class HelloWorld {
public static void main (String args[]){
System.out.println("Hello, World!");
}
}
As you can see, it isn’t very easy to understand. There are weird words like public, static, void, main, and args. You can’t look at this program and intuitively understand it. To understand it, you need to understand classes, and that is an entire subject in itself.
Now, let’s take a look at “Hello, World!” in Python.
print("Hello, World!")
Unlike Java, in Python, you can write the program in only one line of code!
There are no weird words like static or void, and it is much easier to understand.
It is significantly easier to teach “Hello, World!” in Python than in Java, and it is the simplest program you can write. Can you imagine how much harder Java is to explain to a new programmer when things get more complicated?
Python’s simplicity is one of the main reasons why new coders are flocking to it. It has more newcomers than any other language: twenty-two percent of Python programmers have less than a year of experience.
Company Demand
Another reason to choose Python is that it is in high demand. Because employers use Python in so many different fields, you have a lot of options as a Python developer. The following chart illustrates some of the areas you can go into:
You can go into data analysis, web development, DevOps, machine learning, and more. If you are a beginner, that means you don’t have to worry about what field you will eventually focus on and instead can spend all of your energy learning to code.
Every year, the demand for Python developers increases. Here is a chart that shows the growth of different programming languages:
As you can see, Python is one of the fastest-growing programming languages in the world, beating out other languages like JavaScript and Java. That doesn’t mean there aren’t situations where you should learn those languages over Python. There are, and I will discuss them later.
Will It Continue?
Will Python’s use continue to grow? Currently, all indications point to yes. Data science is one of the main drivers of Python’s growth. Glassdoor releases an annual list of the 50 top jobs in the United States, and in their last report, they ranked data scientist as the overall top job.
As you can see in this chart put together by NewVantage Venture Partners, they predict worldwide big data revenue will continue to grow for years to come.
According to Glassdoor, the skills most frequently mentioned in data science job postings are Python, R, and SQL. Nine out of ten job postings require at least one of these skills.
Because Python is one of the top languages data scientists use and data science revenue is projected to continue to grow, it is safe to say demand for Python should continue to increase in the next decade.
Community
The final reason you should consider learning Python is that it has one of the best programming communities in the world. Python is an open-source language, which means a team of volunteers called core developers maintain its code.
In addition to core developers, there are many inspiring evangelists in the Python community as well. People like Takayuki Shimizukawa, a sphinx contributor, Mariatta Wijaya, a core Python developer, and Julian Sequeira, the host of PyBites, spend their time improving the community and are what makes it so special.
There is also PyCon: a yearly conference for Python enthusiasts. PyCon now takes place in 42 countries.
PyCon is a lot of fun, and it is an excellent way to stay current with the latest developments in tech and meet new people. I’ve been to a few PyCons and always had a fantastic time.
Furthermore, Python has excellent documentation (maintained by its community), some of the best programming podcasts, Facebook groups, and newsletters, which makes Python a lot of fun to learn.
Should I Learn Python or Java?
Of course, Python is not the only programming language in high-demand with an active community; Java has those things as well.
Python vs. Java is one of the biggest debates in the programming world. They are even at a tie in popularity.
No wonder so many people are asking the question, “Should I learn Python or Java?” The answer depends on what your goals are.
As I demonstrated earlier, if you are a new programmer, you are better off starting with Python than Java. Python programs are easier for new developers to understand. They are also less frustrating to write. The less frustrated you get as a new programmer, and the faster you pick things up, the more likely you are to succeed.
The counter-argument some people make is that studying C or Java first will make you a better programmer because you learn more about the fundamentals of programming when you learn those languages.
First of all, fundamentals don’t matter when you give up after the first week because you are so frustrated. Secondly, once you’ve successfully learned to program, you can always go back and learn C or Java, which will be much easier to do once you’ve mastered Python.
One exception is if you know you want to create mobile apps on Android.
In that case, it may make sense for you to choose Java over Python, because Java is the native language of the Android platform. While you can write an Android app in Python, you shouldn’t because it will never match Java’s performance.
Should I Learn Python or JavaScript?
For new programmers, there is no definitive answer to “Should I learn Python or JavaScript?” It depends on your situation.
If you know for sure you want to become a front-end web developer, you should consider starting with JavaScript. To become a front-end web developer, you absolutely must know JavaScript, whereas you cannot say the same about Python.
So if you are going to only learn one language before applying to jobs, and you want to become a front-end web developer, you should pick JavaScript. Otherwise, you should choose Python over JavaScript.
The reason Python is a better choice than JavaScript for most beginners is that the latter has pitfalls the former doesn’t have. There is an entire book written about JavaScript’s problems called JavaScript The Good Parts.
Call me crazy, but it doesn’t make sense to start new coders off with a language that has an entire book written about how to avoid the bad parts. There is also a whole thread on Quora dedicated to discussing why Javascript is called the most confusing programming language.
Given the option, it makes sense for beginners to avoid JavaScript’s quirks by learning Python first.
Should I Learn Python or R?
If you are a new programmer, wondering, “Should I learn Python or R?” you should learn Python unless you have a specific reason not to.
R is more difficult to learn than Python, so it doesn’t make sense to start with it in most cases. Plus, while they are both used heavily in data science, Python is more popular than R, and you can work in a wider variety of fields.
Before you make your decision, though, you should think about what industry you plan to go into. For example, R is the industry standard in the medical data processing field, so if you plan to go into that field or another one that favors R, you should consider learning R even though it has a steeper learning curve.
As a rule of thumb, many programmers consider R more effective at statistical analysis, whereas Python is the better choice when you need a flexible language. For example, if you are manipulating data and want to display it on a website or plan to create a digital product based on machine learning.
How Long Does It Take to Learn Python?
You can learn Python in a matter of weeks. That doesn’t mean you can get a job as a software engineer that quickly, but you can learn to write many different types of programs in that timeframe, and you can write your first “Hello, World!” program in a matter of minutes.
If you are already an experienced programmer, you will be able to pick up Python in one to two weeks. On the other hand, if you are brand new, you should expect it to take around five to eight weeks, studying at least 20-40 hours per week.
That much studying will get you to the point where you can learn to build Hangman and other games, web scrapers, and more. Of course, you will still have a lot left to learn.
Ultimately the answer to the question “How long does it take to learn Python?” will depend on a few things. How quickly you learn in general, how many hours a week you are willing to study, and how much programming experience you have. The good news is you should be able to get to a level where you are having fun within a matter of weeks.
Should I Learn Python 2 or 3?
You may also be wondering, “Should I learn Python 2 or 3? This question is an easy one. You should, under every circumstance, learn Python 3. There is no reason to learn Python 2 in 2020.
When you are choosing the best way to learn Python, double-check it teaches Python 3. Be wary of anyone or any resource still teaching Python 2, as it is now officially retired.
Closing Thoughts
Should you learn Python in 2020? Well, it depends on what you want to accomplish. Python is the best programming language for beginners, it is growing incredibly fast, and it has a fantastic community. That doesn’t mean it is always the best choice, though.
If you are a brand new programmer, and you are wondering, “Should I learn Python or Java?” you should go with Python to maximize your chances of success, unless you plan on specializing in mobile development on Android.
If you are a beginner and you are wondering, “Should I learn Python or JavaScript?” think about what you want to do. If you know for sure you want to become a front-end web developer, you can’t go wrong with JavaScript. Otherwise, it is best to start with Python.
As a new programmer, you shouldn’t start with R because it has a steeper learning curve than Python unless you plan to go into an industry dominated by R like medical data processing.
If you are worried it will take months before you can start creating anything useful, don’t worry because you can start building fun programs in Python in a matter of weeks! Also, don’t forget to use Python 3!
If you need help figuring out where to start, I put together a list of the best resources to learn Python. You can also use Coding List to find even more resources to learn Python.
Best of luck!