{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Python Introduction: A few more things" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Getting help:\n", "\n", "1) Use TAB in IPython" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [], "source": [ "a = [1,2,3]" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "2) Using `pydoc3` on the command line." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "3) Online at " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "----" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**A few things to look up in a quiet moment**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "String formatting" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "'My name is Andreas and I like hiking'" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\"My name is {0} and I like {1}\".format(\"Andreas\", \"hiking\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---\n", "Dictionaries" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "5000" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "prices = {\"Tesla K40\": 5000, \"GTX Titan\":1400}\n", "prices[\"Tesla K40\"]" ] } ], "metadata": {}, "nbformat": 4, "nbformat_minor": 0 }