Why Learn Python?

    Stuart Langridge

    Why learn Python? Well, because it’s friendly and everywhere and here and popular and powerful and learnable and lucrative and fun. Why not learn Python?

    I should probably unpack that a bit. Let’s look at some of the main reasons you should learn Python.

    Python is Friendly

    Python is a general-purpose programming language. You can do almost anything with it (and we’ll get to just how wide everything is shortly). But most importantly for someone who’s thinking of learning a little, the Python world is a friendly place to be.

    If you’ve done any programming in the past, you may have come across “pseudocode”: something which looks like a programming language but isn’t really, because its goal is to show you what a program does. Wikipedia articles explaining how to do a thing quite often lay out that description in a sort of mock programming language … and that mock programming language often looks rather a lot like Python!

    Consider explaining to someone how to load a dishwasher: delicate things don’t go into it; make sure you’ve got enough salt; load it up and turn it on. In code terms, that might look like this:

    if dishwasher.salt < FULL:
    for item in crockery:
        if item.dirty:
            if not item.delicate:

    That’s programming code, but it’s hopefully relatively readable and understandable, even if you’ve never seen any Python code at all. And there are no {braces} and no (i++; i>5) hieroglyphs.

    This is helped a lot by Python’s friendliness extending to the Python community as a whole. Stack Overflow has a vibrant community of people asking and answering Python questions and it’s a good place to get help.

    The Python language itself is founded on a set of principles called the “Zen of Python”, in which are guiding ideas such as “simple is better than complex” and “readability counts”.

    People who think programming should be a test tend to accuse Python of being built for (and by) people who say “darn” instead of swearing, and who turn the water off while they’re brushing their teeth like you’re supposed to — but the last thing you need is to have to measure up to someone else’s idea of righteousness while you’re trying to get things done. So they can just gosh darn hecking well push off.

    Python is Everywhere

    Python is used, and is popular, in just about every area of technology. Machine learning is the latest hot thing, and pretty much all of the code you’ll write to work with AI models is written in Python. PyTorch is the dominant machine learning framework.

    If you’re interested in working with image models or other available setups, Google’s Colab has thousands of existing models and code examples, all built with Python, and running in the cloud. It’s good for building web apps and web sites, with Django and Flask, and building software for the cloud by building lambda functions and other serverless setups.

    Datasette is a tool for journalists and researchers to help them share data in a way that’s useful without needing to be programmers themselves, and it’s written in Python.

    A very large chunk of data processing and data science software is in Python, with the Numpy, Scipy, and Matplotlib libraries.

    Almost anything to do with mathematics and statistics will have lots of Python in it. PyQt and Kivy let you build apps for desktops and phones.

    Python is great for working with devices, electronics, and machines. All of the software that’s written to run the amazing Stuff Made Here creations on YouTube is written in Python.

    And Python is great for “glue code” — small scripts for solving particular problems, or to do something on your own machine; not large projects, but little things to help yourself solve a problem — such as starting off a backup, or working out which words fit today’s Wordle puzzle, or dividing up your photos to fit into an album. Python is everywhere.

    Python is Here

    Another good reason to learn Python is that it’s right here, wherever you are.

    If you’re on macOS or Linux, you’ve already got Python. Open a terminal and type python3 and there it is.

    If you’re on Windows, then it’s in the Microsoft Store: see Microsoft’s own instructions on how to install Python either from the store or the web development way.

    On an iPhone, there’s Pythonista and Pyto, and on Android there’s QPython and Termux.

    And to experiment with Python to get a sense of how it works, you needn’t install anything at all. The Pyodide folks have built a full version of Python that runs in a web browser without any installation required, and Jupyter lets you try out Python in your browser too.

    Python is Popular

    Another good reason to learn Python is that it’s popular. The TIOBE Index charts programming language popularity every month. Python is always at or near the top (and, at time of writing, August 2022, it is at the top), and TIOBE themselves say “It is hard to find a field of programming in which Python is not used extensively nowadays.”

    Similarly, the 2022 Stack Overflow developer survey has Python tied for the “most wanted” programming language, ahead of JavaScript, Go, and platform-specific languages such as Kotlin and Swift.

    GitHub’s “State of the Octoverse” summary has Python as second most popular language across all of GitHub’s repositories. Part of this is because Python is available on all platforms; part is because it’s useful in almost every field; and part is because it’s quite easy to grasp.

    It’s often a useful approach to go with the flow — to use a tool that lots of other people use. That way, you have a vibrant community to help when there are problems, and quite often the problem you may be having is something that someone else has already solved for you.

    Python is Powerful

    As a result of being everywhere and being popular, you can do a lot with Python. Almost no problem is beyond Python. Some very low-level or very performance-critical tasks are better in a more complex language, but that’s a lot rarer than you might think.

    In particular, even if you plan to build something in a lower-level language later on, it’s often good to prototype in Python … and then work to speed up the most performance-critical paths.

    Part of Python being everywhere is that it has been and can be adapted to all sorts of tasks, and because of this, Python comes bundled with rather a lot of modules for solving problems as part of its “standard library” — the suite of code that’s available to every Python programmer out of the box.

    The Python standard library has many built-in modules for handling things that you may want to do — such as running web servers, processing data, handling dates, times and timezones, managing files, doing cryptographic operations, managing networking, dealing with HTML, building applications, and talking to the operating system.

    Beyond that, the Python Package Index has a third of a million more packages to deal with almost any conceivable problem. That’s a lot of power at your fingertips.

    Python is Learnable

    Because Python is popular and interesting, there are also plenty of resources to help you learn Python.

    Of course, there are SitePoint’s own programming tutorials, lots of which are dedicated to Python, as well all the helpful community forums.

    FreeCodeCamp has free coding bootcamps dedicated to learning Python, with dozens of exercises to help you get started with the basics and then move on to web programming and databases or scientific computing, and Learn Python has the same.

    The Python website itself also gives some guidelines on getting started with Python.

    There are many places to learn Python.

    Python is Lucrative

    Of course, learning and knowledge are their own reward. But on the off-chance that you aren’t a being of pure energy that’s been uploaded to the Internet and instead have some bills to pay, a career writing Python can be rather well paid.

    At time of writing, in August 2022, Indeed.com has the average base salary for a Python programmer in the USA at $115,965.

    And there are many jobs available. Part of the joy of Python being so versatile and usable in so many different areas of technology is that there are always positions available for those with Python skills. Being paid is good. Python helps.

    Python is Fun

    Where else can you say import antigravity?

    XKCD #353, "Python"

    XKCD #353, “Python”

    The image above is from XKCD, at https://xkcd.com/353/. But if you can’t remember the URL for it, just open up your Python prompt and type import antigravity. Really! Try it now!

    So, Are You Ready to Make a Start?

    So why learn Python? Why not learn Python? It’s friendly and everywhere and here and popular and powerful and learnable and lucrative and fun. Now you’re ready to make a start, here’s some suggestions about where to look first!

    If you learn best by being taught, check out the FreeCodeCamp Python bootcamps. If you’re more into watching videos, then the Introduction to Python course is good for that, and YouTube is a place to look for tutorials and teaching both good and not-so-good.

    If you’re looking to build web projects with Python, How to Quickly Start a Django Project and a Django App is a good place to start, and then Web Development with Django will go a long way after that.

    If you want to get started with data science and statistics, check out the book Data Science: An Introduction and then the rest of the series. Both of these dive a long way into the detail of tools and skills and practical approaches.

    If you’re looking to grow your programming skill in many areas, I recommend this series of books: The Python Apprentice, and its sequel, and its later sequel, which really get into some of the detail.

    And if you learn best by doing … then do that. Pick a small project, a problem that you’d like to solve, and use Python to solve it. Don’t worry about building something for someone else to see; leave the user interface aside for now.

    Pick a simple, real problem and solve it. Maybe it’s something which helps solve the morning crossword by finding all the words that match “–th-n”, or a tiny tool listing all of your photos which were taken in 2017, or something which tracks the calories you ate today.

    Look at some of the tutorials above for how to get started, and Python’s own documentation for full details of everything that comes with Python out of the box: how to ask for input, or manipulate numbers and strings, read a file, or handle dates. Search for answers and read Stack Overflow.

    For those who learn by experimenting, getting your fingers into Python is a great way to go. It’s forgiving of mistakes, and helpful to newcomers. Best of luck to you.