{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Built-in Functions and Help" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "## Use comments to add documentation to programs." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## A function may take zero or more arguments.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* We've already seen some built-in functions\n", "* print(), len(), int(), float(), str()\n", "* Always with parenthesis, even if empty" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Commonly-used built-in functions" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* max() , min()\n", "* round(), will round off a floating-point number.By default, rounds to zero decimal places." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Use the built-in function help to get help for a function." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* Every built-in function has online documentation." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## The Jupyter Notebook has two ways to get help.\n", "* Place the cursor inside the parenthesis of the function, hold down shift, and press tab.\n", "* Or type a function name with a question mark after it." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "scrolled": true }, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Every function returns something.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* Every function call produces some result.\n", "* If the function doesn’t have a useful result to return, it usually returns the special value None." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "