Learning Python with Advent of Code Walkthroughs

Dazbo's Advent of Code solutions, written in Python

The Python Journey - Getting Started with Python

Argand Plot

Useful Links

Python Beginner's GuideThe Python HandbookThe Official Python TutorialGetting started with Python in VS Code TutorialGit

If you’re new to Python, then you’ll want to start here. If you’re already comfortable using Python, then feel free to dive straight into the AoC walkthroughts, using the links above.

Why Python?

If you’re a newbie to programming, then Python is a great language to start with. If you have a lot of programming experience, then guess what? Python is an amazing language to learn, and you’ll love it.

Many years ago, I used to write software for a living. Back then, my preferred languages were Java and C#. These days, I don’t write code in my job, though I do still need to know my way around. Now I write code as a hobby. But I can honestly say: of all the programming languages I’ve ever used, Python is my favourite.

For those of you coming from a background with languages like C, C#, Java, Javascript… You may find Python’s syntax and structure a bit jarring. But trust me: once you get your head around the differences, you’ll love it, just like I do.

Here are some of Python’s strengths:

My Recommendations for Getting Started

I recommend working through the following, to get started:

  1. Install Python
  2. Get a development environment / editor
  3. Get Git
  4. Learn the Python basics

Getting and Installing Python

To execute Python programs, you need to install Python on your machine. It’s possible you already have Python installed. To check, open your command prompt (or shell) and run:

> python --version

If you get a response that shows you have any Python 3.x version installed, then you’re good to go. E.g.

Verify Python Installation

If you haven’t got Python installed, you’ll want the latest available Python 3 version, which you can download from here. It’s really quick and easy to install. It should only take a couple of minutes. Take a look here if you need any guidance on installing Python.

Once you’ve installed it, check the installation as described above.

Development Environment / Editor

You can write and run Python programs without a development environment. But it’s a much better - and more effective - experience, if you have one.

A development environment adds a wealth of features, such as:

Visual Studio Code

My favourite development environment is Visual Studio Code - aka VS Code - which can be downloaded and installed from here. (Note: VS Code is not the same as Visual Studio, which is a different product.)

Some benefits of VS Code:

Visual Studio Code

Installing and Setting Up VS Code

Check out the following useful links:

Install Useful Extensions

Now you’ll want to install some extensions that will make your Python - and general development - experience better. In VS Code, click on the Extensions button in the left hand panel of buttons. I’d recommend installing the following:

Note: if you’ve followed the Getting started with Python in VS Code Tutorial, this will have guided you through installing some of these extensions.

Git

Git is an extremely popular version control system (VCS). A VCS provides capabilities like these:

So Why Git?

Git is an open source VCS, created by the legendary Linus Torvalds. You know… The guy that created Linux.

Git is:

Installing Git

Python Basics

Finally, if you’re completely new to Python, you might want to learn some basics before you begin with AoC. Here’s a list of some decent learning material to help you get started: