Data Structure Variable Types
This written lesson is part of Banana Chip Tech’s Python Crash Course. For video lectures, programming homework assignments, and other content please visit our website.
Variables allow programmers to store information for use later on in a program. As was mentioned in our previous article on basic variable types in python, knowing the type of variable you are using can be critical to getting expected results. In this tutorial, we will spend some time talking about the different types of data structure variables.
Data structure variables aggregate multiple pieces of information into one container, much like a pizza box. Pizza in the pizza box has multiple ingredients that together make up the pizza. Similarly, the data stored in our data structure variables types contain multiple different pieces of information that together makes up the collective data. In other words, data structure variable types are collections of basic variable types.
The first data structure variable type that we will discuss is a string. Strings are simply sequences of text. In order to denote a string, enclose your text in either single or double quotes. The quotations surrounding the text tell python to take that text literally: in other words, not to treat that information as a variable. Let’s look through some examples.
# Define some…