You want to try out programming, but you don’t know quite where to start. In this article I share some thoughts on that based on my own experience when I started learning Python a year and a half ago.
Before we start, I would like to set your expectations. Learning programming isn’t easy. It’s not for everyone. It’s a very difficult process, and it can be a long time before you feel the ‘flow’, or like you’re in the zone. There will inevitably be times when you’re stuck with some problem. At those times, you can either choose to give up or keep searching until you find an answer! There will be times when you lack motivation, and it’ll be totally up to you to push through those blockers. Study, practice, study, practice; it’s an endless process. The more you learn about programming, the more you realise how out of your depth you are. However, despite it all, programming is so damn enjoyable!
There are so many languages to choose from. Why choose Python as your first language? Python is one of those languages that you fall in love with at first sight. Crucially, Python is developed under an open source license which means it is freely usable and distributable, even for commercial use. The Python Package Index (PyPI) hosts thousands of modules that solve almost every problem under the sun - a direct result of Python’s open source nature. Commercial codes could not dream of competing with Python. Another reason to seriously consider Python is that it is growing in popularity fast. See this article on the incredible growth of Python.
Python’s greatest strength is its design philosophy aimed at making programming as intuitive as possible. For example, this is all it takes to print “Hello World!”:
print "Hello World!"
Python helps you understand the fundamentals of programming without getting bogged down by the intricacies of the language itself. Once you are comfortable with Python, learning other language becomes a lot easier. That’s why I recommend Python as a first language.
Python 2 or 3?
There are two major versions of Python in use today. Python 2.7 and Python 3. As a beginner, you are better off learning Python 3. Python 3 is the only one under active development. If you’ve to maintain legacy Python 2 code, it’s still best to learn Python 3 and then learn how to adapt your code for Python 2. Whilst Python 3 fixes a number of problems in Python 2, they are both very similar, and it’s easy to adapt your code for one or the other. You can read more about how the two versions compare here if you’re still unsure.
Identifying a problem to solve using Python
If you are going to learn to use Python, you have first to find a good reason for doing so. I asked for a programming task at work, and I took on the job of creating a tool to analyze data in a bunch of text files in various folders and to plot that data. So, whenever I was watching lectures or reading books on Python, I kept asking myself how I could apply what I learned to my problem which helped me to absorb what I was learning. Without a task to anchor the new knowledge around, you lose motivation reasonably quickly.
Perhaps you could identify an improvement need at work that you could solve with Python? If you use MS Excel repeatedly for doing a specific task, then it’s probably a perfect candidate for a Python makeover.
What I would avoid initially is anything that requires a Graphical User Interface [GUI], as this isn’t Python’s strongest area in my opinion. For that, you need to consider using web frameworks such as Flask or Django. If you’re not familiar with HTML, CSS etc., then it’s probably best to face these behemoths after you’ve become comfortable with the basics of Python.
Tools you need
To program in Python you need some software tools. Rather than tell you what all the different options are, I list out below what I believe to be the best solutions right now, to get you started.
VS Code - Visual Studio Code is a free, open source editor by Microsoft that’s awesome. Python does come with its own editor called IDLE, but that’s not very useful for any substantial development work. VSCode also comes with lots of useful extensions.
PyCharm – PyCharm is an Integrated Development Environment (IDE) for Python. It has a nice user interface, and the community edition is free. I usually do most of my development work on VS Code, but occasionally I do switch to PyCharm to make use of its more extensive features. I recommend trying out IDEs after you’ve become comfortable using simple editors such as VS Code. Otherwise, it can be a bit overwhelming.
Git – Git is a Version Control System (VCS) that lets you keep track of changes in your code. Thus, it gives you the freedom of editing your code freely without worrying about losing it. Being a Distributed Version Control System (DVCS), it also lets you collaborate with other developers to develop a solution to a mutually shared problem. It was created by the living legend, Linus Torvalds, in 2005 for the development of the Linux kernel.
These are the learning resources that I used to get started with Python. With a bit of dedication, you should be able to cover all of it in a month or so. Here is a top tip: With most of the online courses, you can speed up the videos. Start with 1.25x and work your way up to 2x. Trust me, after a while even 2x sounds too slow! Naturally, if the content is tough or you’re coding along, slow it down to whatever speed you feel comfortable.
Harvard CS50 - This is the best series of lectures I’ve ever seen in my life. I recommend this course to both beginner and intermediate programmers who want to brush up on the basics. CS50 isn’t just about Python; it’s a general introduction to programming.
Beginning Python track at Treehouse – For a rapid introduction to Python, do this track at Treehouse. Treehouse is pretty expensive, but you can get a free trial and finish the course pretty quickly. What I liked about Treehouse was that the lectures were short and to the point.
Intermediate Python track at Treehouse – This course builds on the basics.
Introduction to Computer Science and Programming in Python at MIT - There is going to be some repetition if you’ve already done the Python courses at Treehouse. However, with programming, it is essential to have a super strong foundation. So, I’d recommend doing this course next.
Introduction to git at Treehouse – This course is a modest introduction to git. It takes some time to build confidence with git, so don’t worry if you find it hard at first. Everyone starts that way.
These are the topics that I think you need to have become comfortable with as a beginner Python programmer. As you make your way through the learning resources above, these topics should start to sound familiar.
Basics - Conditionals, loops, lists, dictionaries, tuples
Command line - Basic operations in the command line interface for your OS
Jupyter notebook - The Jupyter notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualisations and narrative text. It is a trendy tool amongst data analysts.
Object Oriented Programming - OOP is the most popular programming paradigm. It is based on the concept of classes that contain both data and methods that can act on that data. It’s just a way of structuring your code to make your life easier! I found it quite tricky at the beginning to understand why it was so important, but it does start to make sense the more and more you write code.
Version control with git
Testing with unittest - Good programmers always write tests that check that their code is doing what it’s supposed to do. Make writing tests a habit, and your future self will thank you for it.
Clean Code – Bad code can bring down even the greatest of companies. Programmers have developed a wealth of knowledge over their lifetimes regarding good practices when writing code. Why not tap into that knowledge?
Python for data analysis - Skimming through the Python for data analysis book by Wes McKinney, the creator of Pandas, will give you an idea of what functionality is available in Pandas.
stack overflow – This is where programmers spend most of their lives (sadly :P). Most of the questions that you have are bound to have answers for on this beautiful site. I highly encourage you to ask questions yourself if you cannot find an answer. Not only will you be helping yourself, but also the community out there!
Udemy - I didn’t use Udemy when I started learning Python because I wasn’t aware of it at the time, but I now rely heavily on Udemy to learn about other subjects, and I’m a very happy student.
Github - Github is a place where developers collaborate on code development. Once you’ve been programming in Python for a few weeks, I’d recommend starting to check out popular packages on Github. Pandas is a good example. Copy their styles and programming techniques as much as possible! By copying other developers, you’ll begin to appreciate why they do things a certain way.
sentdex - sentdex is a really cool YouTube channel with many videos on Python. Watching other programmers is a great way to hone your craft.
Conferences - You don’t know what you don’t know. There is much ground to cover in programming. You don’t have to be an expert in everything, but it’s good to be aware of what’s out there. This is why it’s important for programmers to attend conferences. Thankfully, most of these conferences upload their videos to YouTube so that you can watch them for free! I would dedicate a portion of your time every week to watching videos from Python or even other programming conferences. It’s okay if you don’t understand everything, as long as you can follow its gist. Over time, this will help you expand your knowledge, and you’ll find yourself capable of following lectures on more advanced topics.
Hopefully, this article has helped you get started with Python. I would love to know what you thought of my article, so please do leave me a comment, especially if there’s something you think could be improved.