{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Notes on Week 2 2018-02-02" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "to make a new cell press 'b'" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "8" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "3+5" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "to make a new markdown cell press 'b' and then 'm" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "to execute a cell press 'control + enter'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "pressing 'shift + enter' will run a cell and then make a new one" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "if you are inside of a cell and want to make it a markdown, you can press 'control + m' and then 'm'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "to delete a cell press 'd''d'" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "False" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "6==7" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "ename": "SyntaxError", "evalue": "can't assign to literal (, line 1)", "output_type": "error", "traceback": [ "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m 6=7\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m can't assign to literal\n" ] } ], "source": [ "6=7" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To include an image you can use normal md language
![](https://jupyter.brynmawr.edu/images/jupyter-sq-text.png)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To make a variable simply type it" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "x=50*2/3+1" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "to retrive it you can simply type it" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "34.333333333333336" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "x" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In python variables have types, to evaulate the type we can do:" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "float" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(5/4)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Strings" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'Suppose there is a piegeon, suppose there is.'" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\"Suppose there is a piegeon, suppose there is.\"" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "roastbeef= 'Suppose there is a piegeon, suppose there is. \\\"someone\\\"'" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": true }, "outputs": [], "source": [ "two_lines='line one\\nline two'" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'line one\\nline two'" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "two_lines" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "line one\n", "line two\n" ] } ], "source": [ "print(two_lines)" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "9" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "x=5\n", "y=4\n", "z=x+y\n", "z" ] } ], "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.6.0" } }, "nbformat": 4, "nbformat_minor": 2 }