{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "54\n" ] } ], "source": [ "x = 6 * 7 + 12\n", "print(x)" ] }, { "cell_type": "raw", "metadata": {}, "source": [ "In the hub, create a text file, Python console and terminal window. Put in three panels. Send thumbs up." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "1. Use number\n", "1. to create \n", "1. numbered list" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* You can use indents\n", " * To create sublists\n", " * of the same type\n", "* or sublists" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## A Level-2 Heading" ] }, { "cell_type": "raw", "metadata": {}, "source": [ "\n", " 1. Get funding.\n", " 2. Do work.\n", " * Design experiment.\n", " * Collect data.\n", " * Analyze.\n", " 3. Write up.\n", " 4. Publish.\n", " \n", " Create the above using Markdowns.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$\\sum_{i=1}^{N} 2^{-i} \\approx 1$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " 1. Get funding.\n", " 1. Do work.\n", " * Design experiment.\n", " * Collect data.\n", " * Analyze.\n", " 1. Write up.\n", " 1. Publish." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "age = 42\n", "first_name = 'David'" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "David is 42 years old\n" ] } ], "source": [ "print(first_name, 'is', age, 'years old')" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "ename": "NameError", "evalue": "name 'last_name' is not defined", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlast_name\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;31mNameError\u001b[0m: name 'last_name' is not defined" ] } ], "source": [ "print(last_name)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "age in three years: 45\n" ] } ], "source": [ "age = age + 3\n", "print('age in three years:',age)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "h\n" ] } ], "source": [ "atom_name = 'helium'\n", "print(atom_name[0])" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "hel\n" ] } ], "source": [ "print(atom_name[0:3])" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "6\n" ] } ], "source": [ "print(len('helium'))" ] }, { "cell_type": "raw", "metadata": {}, "source": [ "# Command # Value of x # Value of y # Value of swap #\n", "x = 1.0 # # # #\n", "y = 3.0 # # # #\n", "swap = x # # # #\n", "x = y # # # #\n", "y = swap # # # #\n", "What is the value after each line is executed\n", "\n", "x = 1.0 # 1 # not define # not define #\n", "y = 3.0 # 1 # 3 # not define #\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.3" } }, "nbformat": 4, "nbformat_minor": 4 }