Pure Python


Ever wanted to learn to code? Maybe there are some tasks you do over and over that you'd love to get a computer to do them for you. Perhaps you've got an idea for an app, but no way to make it happen. Or maybe you've heard that coding is an important skill in today's economy and want to get ahead. Maybe you're just curious. Well, saddle up and let Sam Cassidy take introduce you to Python from the absolute beginning - warts and all!

Module Coordinator

Sam Cassidy




Getting Started



Ever wanted to learn to code? Maybe there are some tasks you do over and over that you'd love to get a computer to do them for you. Perhaps you've got an idea for an app, but no way to make it happen. Or maybe you've heard that coding is an important skill in today's economy and want to get ahead. Maybe you're just curious. Well, saddle up and let Sam Cassidy take introduce you to Python from the absolute beginning - warts and all!



Numbers and Variables



One of the most basic tasks in programming is giving things names so that we can refer to them later in the code. We call these things "variables" and in this lesson we learn all about them and they different kinds of types that exist in Python (and more broadly in programming).



Logic and Flow



When programming, it is rare that our programs are so simple that they are merely a list of instructions. Often, we are required to perform an operation several times (with slight modification), or make a decision as to whether to perform one operation or another. These require the related notions of logic, and flow control



Importing More Functions



We have been using just a small handful of functions so far and these functions come "pre-loaded" when we start using any Python environment (e.g. Spyder, Jupyter Notebook etc). Sometimes we need to access functions that exist in addition "modules". This lesson describes how we import these modules and functions.



Defining Our Own Functions



We have seen that there are many useful functions built-in to Python, and many more available sitting in the standard library and other modules just waiting to be imported to help us complete tasks. This is far from the end of the story though. The real power of functions is that we can create our own, making a piece of code that can be reused anywhere in our program, or imported into other programs. Buckle up. This shit just got real.



Data Structures



Python's data structures are highly flexible and easy to use for a variety of tasks. The basic idea of a data structure to store information in an organized fashion for later use. This tutorial and accompanying video aims to give an overview of the kinds of things Python's data structures can be used for, and how they can be efficiently created out of existing data. We'll also look at list comprehensions, one of Python's best features.



The Command Line



This article is not about Python. But it is worth the time of any new Python programmer, or anyone who uses computers a lot. We have to have a discussion about the command-line. Most of us in the modern era have grown up using a graphical user interface (GUI) to interact with our computers. This is where we use a mouse or touch screen to press on-screen buttons, drag-and-drop files, highlight text, move a scroll bar, or bring up a menu. But there is another method, in which we interact with the computer by typing in text commands, and getting text output. For many, this is an ancient relic seen only in films such as The Matrix, War Games, or Hackers, but in the world of computers and computer programming, it remains an invaluable tool



Working With Text



Working with strings is an important skill in Python. For one, reading data into a program will often take the form of a file containing text, and so we must be proficient in extracting the bits we're interested in. Moreover, we are humans. We do not want the computer to merely spit out a list of numbers after performing a calculation; we want our outputs presented in a way that we can actually read.



Regular Expressions



Regular expressions are very powerful, but also rather fiddly. So, if you can get away with not using them, then great. But when you need them, you really need them.



Opening Files



When we're writing a program, it's pretty clear that we don't want to always have to type the data we're working with directly into the source code. Rather, we want to get the data from an external source: either the web, or a file on our computer. In this article, we're going to look at how to work with files in Python.



Reading and Storing Data



There is a natural dichotomy between data files that are easy for a computer to read, and data files that are easy for a human to read. In this article, we'll look at three common kinds of data files you are likely to encounter, are fairly human-readable, as well as being very easily manipulated in Python.



Advanced Flow Control



So far, we have met if, elif and else, as well as for-loops and while-loops. Now we take a look at some more tools we have to control the behaviour of loops. Briefly before that though.



Advanced Functions



In this article we're gonna cover a lot of ground. So far we have seen that functions can be used to encapsulate tasks we want to perform throughout our programs. They take some input, perform some computation, and then give us an output. We're now going to explore a number of powerful concepts involving functions, culminating in a brief discussion of functional programming, a programming paradigm that is quite different to the methodology we have used so far.