{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Python Collections, Numpy Arrays, and Slicing\n", "\n", "Below, we explore some basic Python programs for demonstrating use of Python's built-in data types, focusing on **collections** and `numpy` **arrays**. We also introduce the concept of **slicing**, which allows us to quickly and cleanly extract subset of sequence and array types.\n", "\n", "\n", "## Collections\n", "\n", "Python has built-in support for \"collection\" data types - these are complex data types that hold other collections of other data. Python provides three basic collection types:\n", "\n", "
Type | Description | Examples |
---|---|---|
String | \n", "Collection of characters, indicated by single or double quotes | \n", "\n",
"
| \n",
"
List | \n", "Collection of 'mutable' objects (they can be changed), indicated by brackets ([ ]) | \n", "
| \n",
"
Tuple | \n", "Collection of 'unmutable' objects (they can NOT be changed), indicated by parentheses (( )) | \n", "
| \n",
"
Dictionary | \n", "Collection of key:value pairs, where keys are used to look up values, indicated by braces ({ }) | \n", "
| \n",
"