Programming & Scripting

Learn Python Fundamentals

Python is a big deal. It is one of the fastest growing and most in-demand programming languages in the world today. Python is so flexible and versatile that it is used for nearly every job that a programming language can do. Python powers desktop applications, is used for Linux system scripting and automation, acts as a glue language between Linux applications, is a supplemental scripting language in large programs like GIMP, Blender, and Autodesk Maya, performs crucial scientific and...
Read More...

Python Functions

Introduction Code would quickly become an ugly and unruly mess if there wasn't a way to easily repeat and reuse it. You've already seen some of that with loops. They're great for repeating the same task multiple times right away. What if you wanted to reuse a block of code whenever you wanted? Well, that's where functions come in. Here's another trip back to math class. If you remember, functions took in a number, did something to it, then outputted the new value. They were often represented...
Read More...

Python Advanced Dictionaries

Introduction You've already gotten acquainted with dictionaries, but just like the other data structures Python supports, there are methods and more powerful ways to use them. There aren't as many methods for working with dictionaries as there are for lists, but that's because dictionaries just don't need them. Plus, many of the ones that do exist, work to break down dictionaries into lists and tuples to make them easier to manage. So, those list methods can be used in conjunction with the...
Read More...

Python Dictionaries

Introduction Somebody hit lists with gamma rays. Okay, so Dictionaries aren't the Incredible Hulk, but they are supercharged in what they can do. In other languages, dictionaries are referred to as hashes, associative arrays, and associative lists. It's probably best to think of them as associative lists because that's exactly what they are. Dictionaries are lists that associate two values with one another. To think of it in terms of an actual dictionary, they associate a word, or key with a...
Read More...

Python For Loops

Introduction There is yet another type of loop. That loop is designed for iterating sets of data. That's right, lists. Unlike while loops, these for loops have a defined length based on the data set that they are iterating over. Generally, for loops are used to access and modify each element in a list. To do this, they temporarily represent each element as a new variable used only within the loop. for loops have a slightly different structure than while loops do. They begin with the word for ,...
Read More...

Python While Loops

Introduction Many times in programming, you will need to repeat the same task many times. In fact, looping through and repeating an operation is one of the cornerstones of programming. After all, one of the things that computers are way better than humans at is performing repetitive tasks without getting tired or making mistakes. One of the simplest ways to make a program repeat the same task is to use a while loop. A while loop repeats the same block of code while a condition is true. When...
Read More...

Python If Statements

Introduction How can a program make a decision? Can a program choose between two or more options. Actually, it can. This isn't some kind of advanced AI concept, it's just a matter of evaluating whether or not certain conditions have been met and choosing a response. The way that a program can evaluate a condition comes down to true and false. If something is true, do this. If it isn't true do, that. The if statement is the structure for a program to pose these questions and evaluate whether or...
Read More...

Python Boolean Operators

Introduction If you've been following along, you're probably tired of hearing about lists right about now. Well, this guide has nothing to do with lists! Remember back when you first leaned about variables; how there was one that just held True or False called a Boolean? There hasn't been a guide on them because Booleans are actually that simple. However, there are symbols called Boolean Operators that are used to evaluate whether a statement is true or false. They compare statements and...
Read More...

Python Tuples

Introduction Tuples are immutable data sets made up of data of different types. While tuples are very similar to lists, they are different in those key ways. Tuples cannot be changed once they are created. The data they hold can be passed to a different tuple, but the original tuple cannot be changed. This means that tuples don't have methods for manipulating them like lists do because they cannot be manipulated. Like lists, tuples can also contain data of different types. Tuples can contain...
Read More...

Python Multidimensional Lists

Introduction Now it's time to take lists to a new dimension. No, you don't need to learn how to code in "The Upside Down," but there are additional degrees of complexity to lists. Lists are used to hold data, but they are also used to categorize it. Values inside a list can be further broken down into other sets. That's essentially what a multidimensional list is. Two Dimensional Lists What is a list that holds lists? That's all a two dimensional list is. The list below consists of three...
Read More...

Python List Methods

Introduction Using methods with lists gives you the power to manipulate the data stored in the lists quickly and effectively. Many of these methods are concerned with finding, adding, and removing pieces of data stored within the list they are being called on. Others are more concerned with the structure of the list itself. In any case, they will make your experience using lists a lot less frustrating by saving you time and effort writing and rewriting the same code. Finding the Length Yes,...
Read More...

Python Lists

Introduction Lists are a big deal. It really can't be overemphasized what a big deal they are. Lists are not only used for iterating through data, but they are also a popular data storage and categorization method used for handling data as a program is running. For anyone who's programmed in another language, lists are often known as arrays. Lists may be either very simple or very complex, but they all follow the same rules. Lists may contain different types of data, but be careful when...
Read More...

Python Comments

Introduction This guide isn't about programming. In fact, there is no new code involved at all. However, it does have everything to do with making sure that the code that you write is understandable to both yourself and anyone else that might look at it down the line. If you've looked at any open source projects, you've probably noticed notes placed in by the programmers. Those notes are just plain text. The programming language doesn't compile or interpret them in any way. It just ignores...
Read More...

Advanced Python Strings

Introduction In the previous guide, you learned the basics of handling strings in Python. In this guide, you will explore some of the more complex things that strings are capable of. There are tools built into Python, called string methods, that help you to handle strings and do some very powerful things. Through the use of string methods, you can masterfully manipulate text and use it to its fullest potential without writing a ton of code. Navigating a String Strings aren't words. They aren't...
Read More...

Python String Basics

Introduction Strings are called what they are because they are strings of characters. It doesn't matter if those characters are letters, numbers, symbols or spaces. They are all taken literally and not processed within a string. That's why strings are sometimes referred to as string literals. String Basics If you've been following along with the previous guides, you've already experimented with some strings. You've typed in some, and you've printed them back out. What about getting user input...
Read More...

Working With Number Variables In Python

Introduction Obviously working with numbers in programming is important. Python as excellent mathematical capabilities, and there are tons of additional libraries available to extend Python's built in functionality for even the most advanced calculations. Of course, the basics are important too, and numbers and some basic calculations come into play when controlling the flow of programs and making selections. That's why knowing your way around working with numbers in Python is especially...
Read More...

Python Variables

Introduction Do you remember variables from math class in school? Variables in programming are actually very similar. Variables are just symbols that that represent a value and that value can be changed; thus the name variable. Unlike in math, variables in programming can be much more free form. Variables don't just have to be a letter. Variables can be a single character, but they are more commonly a word or a short descriptive phrase in lower case with words separated by underscores. It's...
Read More...

Experimenting With Numbers and Text In Python

Introduction You probably want to jump in and start coding right away. That's a great attitude to have, but it's much better to experiment with the language and your programming environment first. If you've never programmed or never worked with an interpreted language like Python before, it's important to get a feel for the way Python works and start to develop a workflow. One great aspect of Python being interpreted is the ability to write a couple of quick lines of code and test them out in...
Read More...

Python Files and the Interpreter

Introduction Python is an interpreted language, meaning that it is compiled every time that it is run. There are a number of pros and cons when talking about an interpreted language like this. First, on a positive note, they tend to be easier to debug. They fail immediately when they are run, and tell you what went wrong, which is nice compared to compiled languages like C/C++, which can compile just fine, but fail silently when run. Interpreted languages are also very portable. All you have...
Read More...

Python Introduction and Installation Guide

Introduction Python is a dynamically typed, interpreted, general purpose programming language. It's useful for everything from system scripting, to web applications, to full graphical desktop programs. Because of that, it's no surprise that demand for Python programming skills is only increasing, and top companies like Google, Mozilla, Instagram(Facebook), and Reddit rely on it as part of their core technology stack. Not only that, but Python is a favorite in both academic and scientific...
Read More...