Why Python Should Be The First Programming Language You Learn
Why should Python be the first programming language you learn? It’s awesome. That’s all you need to know. You can stop reading here and start coding now.
Of course, you want to know more. But it’s that simple. As you will see, you can start coding now with Python.
Besides being awesome, Python should be your first programming language because you will quickly learn how to think like a programmer. Python is very readable. You won’t waste a lot of time memorizing the arcane syntax that other programming languages will present you. Instead, you will be able to focus on learning programming concepts and paradigms. Once you have those tools under your belt you can move on to other more powerful, specific languages and readily understand a given piece of code. But, don’t be mistaken. You are not playing with a kids toy. Python is super-powerful! There’s a reason NASA uses it. As a beginner, you’ll be able to accomplish anything you need with Python.
Python is easy to learn. The learning curve is very gradual. Other languages can be quite steep. With Python and the proper combination of ambition and attention, you could whip together a game in a day knowing nothing before you started. As I mentioned above, Python places an emphasis on readability. Here’s an example of how easy and readable Python is. The first code example below is written in C++:
std::cout << "Hello, world!\n";
And here’s code with the same output in Python 3:
Brilliant, right? Because it looks like everyday English, it’s so much easier to type. What you will later come to appreciate about this is the speed at which you can write a program. And that means less time coding and more time playing.
Perhaps you’ve already tried to learn a programming language. You might have worked through the “Hello, World! Program” (not to be confused with this The Hello World Program) and then found yourself lost in the woods. Yet another great thing about Python is the wealth and abundance of documentation. You can easily find what you’re looking for at python.org. If you can’t, the Python Tutor list is full of a friendly cast of characters ready and able to answer your questions, so long as you are polite.
Once you’ve got the basics down, you’re going to find yourself bored with outputting text and crunching numbers. That’s when you’ll begin to leverage the power of Python’s libraries and modules. What’s a library? Well, where did we go for answers before the internet? The library! In computing, a library is a collection of “books” that perform specific tasks and extend your programs functionality. So, instead of writing the book you need, you can just check it out. In Python, a library is a collection of modules. If you want to do some fancy stuff with graphics, you might check out the Python Imaging Library. Or, if you want to make a game you could use either the Pygame of the Pyglet libraries. If science is your thing, there’s the SciPy library. What’s a module? Simply put, a module is a a file, like a book in the library, that contains functions you can import into your program.
Python makes it very easy for you to use. It comes bundled with IDLE, which does not mean how you will be spending your time using Python. IDLE is both an interactive shell and an integrated development environment (IDE) for Python . What does that mean? It’s easy to write and run Python programs. You quickly and easily do both from within IDLE. But wait, you ask, what’s an IDE? An IDE is a software application that makes it easier to develop computer programs. IDLE is written in and for Python. There are some awesome features in IDLE. It has syntax highlighting, which means text will be displayed according to category within your program. There’s autocompletion, which means… And smart indent, which is great when you’re in the zone. And, it gets better. Your program will run immediately. That means less time waiting for assembly and compiling and more time debugging! This will all make sense later.
In case I was too subtle, it’s important to point out that Pythonistas (as they are known) are a funny bunch. It’s very important to have a sense of humor, in life and in Python. The language is, after all, named after Monty Python. What? You don’t know Monty Python? You’ve got some homework to do.
We at The Hello World Program advocate GNU/Linux operating systems, but we know that’s not for everyone. Yet. But Python is for everyone! In fact, if you’re using a UNIX machine like a Mac or running a Linux distro, it’s already installed on your computer. If you’re on Windows, it’s very easy to do yourself. Just head over to python.org and download it. You’ll be up and coding in no time.
Now, for an added challenge: in Python, write a program that reads this blog entry and counts the number of times I used the words “easy” and “awesome”. This shouldn’t take you long.
Start learning Python now with our first tutorial, And Now For Something Completely Different… An Introduction to the Python Programming Language.