{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "name": "Example.ipynb", "provenance": [], "collapsed_sections": [] }, "kernelspec": { "name": "python3", "display_name": "Python 3" } }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "SDtiowU30ygW" }, "source": [ "# Introducing the Notebook\n", "\n", "Google colab is a version of the 'jupyter' notebook. This is an example notebook. Edit this note book to learn how the notebook system works. \n" ] }, { "cell_type": "markdown", "metadata": { "id": "TqNQ66jLePXa" }, "source": [ "# Cells in the Notebook\n", "\n", "The notebook is a sequence if cells. \n", "* A cell (such as this one) can contain text. This makes a data analysis notebook a readable document. \n", "* Text is formatted using *markdown*\n", "* Other cells in the notebook contain code. The analysis document becomes executable.\n", "\n", "The next cell contaions code. Run it!" ] }, { "cell_type": "code", "metadata": { "id": "KFw99xYk1PZb" }, "source": [ "x = 1 + 2\n", "x" ], "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "metadata": { "id": "PkHcjHxAfH9I" }, "source": [ "Subsequent cells can use the variable introduced earlier." ] }, { "cell_type": "code", "metadata": { "id": "IFa80aLG1nks" }, "source": [ "x ** 2" ], "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "metadata": { "id": "cDVAlToIfQsd" }, "source": [ "Writing an expression causes the value to echoed. We can use the notebook as a calculator" ] }, { "cell_type": "code", "source": [ "3 ** 4 ** 5" ], "metadata": { "id": "VdW6cna8NDnK" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "metadata": { "id": "FVQhFQYq2okd" }, "source": [ "# Problems to Watch Out for When Editing\n", "\n", "You are free to run cells out of order, changing and rerunning earlier parts of your program. However, this can be confusing:\n", "\n", "* There is a global environment of values and variables\n", "* A variable continues to exist even if you remove the code that created it \n", "\n", "**Recommendation:** periodically rerun the whole notebook in order\n" ] } ] }