By Adrian Rosebrock January 18, 2017

Why Learn Python

In this article we're going to talk about why you should learn python right now.

  1. Python is Great for Beginners
  2. Web Development with Python
  3. Iterative, Agile Design
  4. Python has High Salaries
  5. Python Security
  6. Python, Artificial Intelligence & Machine Learning
  7. Python Diversity & Flexibility

You know what I really hate?

Technical articles aimed at programmers that explain why you should do something where the author doesn’t draw on any personal experience.

Seriously — how can you trust someone who has never been in the trenches, fought the war, or come home battle-scarred but victorious?

I took a different approach when putting together this article and wrote something I believe other programmers like myself would want to hear:

Seven real, personal stories about the Python programming language and how it helped me in my career.

I’m not here to evangelize for Python.

I’m not here to tell you that Python is the “best programming language” (whatever that means).

I’m not even going to tell you to “try” building your next project in Python because I have no idea what your next project is and whether or not Python would be a good fit for it.

Instead, my goal is to relate to you as a programmer. I’m going to share some personal stories from my career as a programmer and I hope that you’ll see why you should learn Python.

If you stick around and read through the rest of this article, I think you’ll come to the same conclusion I did years ago — Python is going to make an impact on your future, whether you realize it or not. So I hope you'll see why you should learn Python.

With that said, let’s dive in.

#1. First time programmer? Learn Python quickly.

I remember when I started my journey to becoming a software developer over 15 years ago.

I was just a kid, maybe 13 years old at most.

Andrew, a childhood friend of mine, introduced me to the world of computers and showed me how they could do much more than just connect to the internet and access websites.

He showed me the basics of HTML and how websites were actually built using “tags” and a basic markup language.

From there on, I was addicted.

The unbridled level of control. The freedom of a creator. The canvas of an artist. I was a programmer in the making.

The next morning I pleaded with my mom to drive me to the local library, so I could learn more about computer programming.

Perhaps unsurprisingly, the first book I reached for had the word “BASIC” in the title. For a beginner, the name alone pulls you in.

Over the summer (and with the help of Andrew), I used that book to learn the fundamentals of programming, basic control structures, and how to organize a program.

But at the end of the day, I felt sorely disappointed — and I almost gave up programming altogether come the start of school in autumn.

How come?

I couldn’t do anything “cool” with BASIC — the language, by its very nature, was extremely limiting and constrictive (ironic, since I now use Python, named after a snake that squeezes and crushes its prey before eating it).

I couldn’t access low-level system resources.

I couldn’t load and manipulate images.

And any type of statistics or computational analysis?

Forget about it.

I spent all that time learning how to program, but I didn’t really have anything to show for it.

All that said, I forged ahead. I realized my programming “career” didn’t have to stop at BASIC.

During my freshman year of high school, I moved on to C/C++. It was a much harder language that took me a while to become proficient at. I also really enjoyed the freedom that C gave me, even if it meant shooting myself in the foot from time-to-time.

After C/C++ I moved on to Java and object oriented programming. That was fun, but it felt like it took an eternity to get anything done.

By the end of my sophomore year of high school, I had tried scripting languages for the first time: specifically, Python.

I was amazed.

The code was easily readable — almost like writing rudimentary English or simple abstract mathematics.

There was also an object oriented flavor to the code itself. Not to an extreme like in Java, just enough of a sprinkle to make me feel like it was an old friend — there when I needed it.

Perhaps most surprising was how elegant my code looked.

The use of whitespace ensured my code was organized coherently into tidy little blocks. And by following basic coding standards and suggestions, I was writing beautiful looking, easily maintainable code by the end of my first day using the language.

In retrospect, I wish I could have started with Python.

Sure, BASIC taught me the fundamentals of programming, but Python can do that, too, in the same, simple manner.

If I had to turn back the clock, I would have skipped BASIC altogether and gone right to Python. I would have enjoyed the experience more, gotten a better investment return on my time, and been better prepared to learn C/C++ and Java.

So if you're trying to decide on the best programming language to learn, Python deserves a serious look.

#2. Python is used for web development.

I’ll admit it:

When I first started writing web applications, I wasn’t using Python — I was using PHP.

In fact, I was so fond of PHP that I wouldn’t even consider the possibility that another programming language might be better for web development.

I was wrong.

Dead wrong.

It wasn’t until my friend Patrick showed me the Python web framework Django that my mind changed for good.

What once took me hours in PHP could be done in minutes using Python.

Not to mention the fact that my code was a lot faster and more stable.

From Django, I moved on to Flask, another web framework, but tiny and built for customizability.

Once I started working with Django and Flask, I never looked back to PHP.

While the majority of websites still run on PHP, many new web applications are being built using Python.

If you’re planning on doing any web application development, give Python and Django/Flask a try. I think you’ll be quite impressed.

#3. Iterative, Agile Design.

Success in startup companies does not come overnight.

Instead, it comes from a series of iterations that often look like this:

  1. Find out what the (potential) customer wants/needs.
  2. Build the Minimum Viable Product (i.e., the smallest possible set of features that solves the customer’s problem).
  3. Show it to the customer.
  4. Repeat the process until the customer is happy.

This process allows startups to “stair step” their way to success. Start with an idea, then refine the idea and product until you’ve “made it.”

In the online world, Python is ideal for this process.

The language allows you to code quickly, building complex applications with minimal lines of code (5x less than Java and 10x less than C++).

Going from idea to implementation quickly is critical in the startup world, so if you are interested in working with startup companies, I highly suggest you learn Python.

Personally, I’ve been working in startup companies since I was 18 years old.

Whether the particular product was web-based, mobile, or enterprise, Python eventually found its way into the company, either as part of the core product or as a supporting utility. I have no doubt this trend will continue in the future.

#4. High Salaries.

In a 2016 developer salary study created by indeed.com and published by codementor.io, it was found that the average Python developer salary was $107,000 USD:

python

Based on this study, Swift, Python, Ruby, C++, and Java will make you the most money (with PHP rounding out the bottom).

Given the monetization of mobile applications, perhaps it’s unsurprising to see Swift at the top of the list, as it’s typically used for developing iOS and macOS applications.

But just below Swift is Python and Ruby: the only two scripting languages in the top five.

While Ruby is a general-purpose programming language and is used for a good many applications, when polling a set of Ruby developers, more times than not you’ll find that they are using Ruby for web development.

Python on the other hand is different: it’s more diverse.

Don’t get me wrong, you’ll undoubtedly see many programmers using Python for web development, but you’ll also see Python powering scientific applications as well.

Drawing from my own personal experience, I can tell you that I followed this exact totem pole of salaries.

When I was working as a PHP developer, I was making the least amount of money in my career.

I then moved on to Java and enterprise development where I enjoyed a significant bump.

But the real change for me didn’t happen until I started working in the computer science Python community.

While this is strictly an anecdotal opinion, I truthfully believe that Python opens more doors than Ruby does, especially from a scientific standpoint.

My prediction is that given the rise of Python as not only a general-purpose programming language but also as a scientific programming language, we’ll soon see Python take over Ruby in terms of higher salaries.

#5. Python Security.

Five months ago a gym buddy of mine introduced me to his son, Sean.

Sean had just graduated from high school and was heading off to the University of Chicago come the fall semester.

Curious about his major, I asked Sean what he was planning on studying.

His response?

Cyber security.

It’s a great field to be in and there’s lots of money to be made.

Think about it — being involved in cyber security has many parallels to operating a business designed around morgues and funeral homes.

It may be macabre, but people will continue to die; there’s no chance of funeral home businesses stagnating unless we magically find the elixir of life.

Similarly, there will no shortage of cyber attacks. There’s even speculation that the next World War will be won and lost in cyberspace rather than through the actions of troops on the ground.

Sean told me about his high school’s programming classes, how he took two years of Java, object oriented programming, and software design.

While I was impressed that his training even had two years’ worth of programming courses, I was a little saddened to hear they weren’t teaching any scripting languages.

Over Christmas break I caught up with Sean and asked him how he was enjoying the University of Chicago.

He was doing great.

He was rocking all his computer science classes.

He joined the school’s cyber security team…

…and he even learned Python along the way.

Grinning, because I already knew the answer, I asked him: “What made you learn Python?”

He replied back, “It’s just so easy, man! You can do literally anything with Python. When I first joined the cyber security team, I was writing penetration testers with Java. It took me hours to code what my peers were doing in minutes.”

Sean had realized the power of scripting languages.

While you may sacrifice some execution speed, you gain more flexibility, facility in writing code, and — best of all — the ability to experiment faster.

My opinion is that Python includes the best of all these worlds. If you haven’t tried it yet, you really should.

#6. Python is the future of AI and Machine Learning.

The Python programming language is currently fueling scientific programming, but this wasn’t always the case.

For years academic scholars and private researchers were using the MATLAB language for scientific research.

That all started to change with the release of Python numerical computation engines such as NumPy and SciPy, allowing complex calculations to be done by a single “import” statement followed by a function call.

Slowly but surely, Python started to take over as the preferred language for computer science research.

In fact, I wrote all of the code used to gather results for my Ph.D. dissertation in Python.

By the time I graduated with my bachelor’s degree, even non-computer science students had started to teach themselves Python and use it to power their own research. Computational biology is a great example of where you’ll see non-computer scientists leveraging Python.

These days I spend much more time writing scientific Python code than I do anything else, so I’m clearly biased, but I can tell you this:

Python is the future of Artificial Intelligence.

Given the flexibility of the language, its speed, and the machine learning functionality delivered by libraries such as scikit-learn, Keras, and TensorFlow, we’ll continue to see Python dominate the machine learning landscape.

There is no doubt in my mind: if you are even remotely interested in doing computer science research, you should learn Python.

#7. Diversity and Flexibility.

Over this past summer I set up my first 401k.

I chatted with my financial advisor on a number of occasions, discussing various investment vehicles and strategies, and different methods to allocate my portfolio.

No matter how the conversation started, it always ended up in the same place:

Managing my risk, and more specifically, how to minimize it.

In the investment world, this simply boils down to “not putting all your eggs in the same basket.” If you drop your basket, you crack all your eggs.

Your goal, therefore, is diversification: put a chunk of your money into large company stocks, another (smaller) chunk into small/mid-size company stocks, then another chunk into bonds, and finally any remainder into foreign markets, precious metals, etc.

Makes sense, right?

If you put all your money into stocks and the market crashes again like in 2008, your retirement portfolio would be entirely crushed. By diversifying, you minimize your risk.

Believe it or not, the programming world isn’t so different.

Over the past decade, it’s become increasingly valuable to have a programming specialization, but you have to be careful not to pigeonhole yourself as “that Java guy” or “that C++ guy.”

While it’s extremely important to have a niche and speciality, you also need to make yourself marketable.

For example, I’m a programmer, and I specialize in computer vision and machine learning.

However, I’m not just a “Python guy” or an “OpenCV guy.”

I’ve used Java to build large-scale enterprise and government applications.

I’ve utilized C++ to work on real-time applications.

I’ve even custom built PHP applications to scale to hundreds of thousands of users.

My point is this: my resume and curriculum vitae are diversified.

I have a niche and know my niche well, but I can also take on just about any other task.

If you don’t have Python under your belt, consider adding it to your repertoire and increasing your diversification and marketability as a programmer.

What now?

So, you’re ready to learn Python, but how do you get started?

I’ll be back next month to answer that question and provide my favorite resources for learning the Python programming language.

See you then!

About the author

Adrian Rosebrock

Adrian blogs about computer vision, deep learning, and Python over at PyImageSearch.com. He is currently running a Kickstarter campaign to fund his new book, Deep Learning for Computer Vision with Python. To learn more, just click here.