{ "metadata": { "name": "", "signature": "sha256:64bc6ed635ee782424e2a9c6d347d0d839901e22bcfed6521e3f281977a7711d" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "C Library Functions\n" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 15.1 page no : 655" ] }, { "cell_type": "code", "collapsed": false, "input": [ "print \"ratsdrowninwordstar is a palindrom\"\n", "print \"length of \\\"ratsdrowninwordstar is a palindrom\\\" is\",\n", "Len = len(\"ratsdrowninwordstar\")\n", "print \"%d\"%Len" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "ratsdrowninwordstar is a palindrom\n", "length of \"ratsdrowninwordstar is a palindrom\" is 19\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 15.2 Pageno : 656" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "Num = 123.54\n", "fNum = 0.0\n", "cNum = 0.0\n", "fNum = math.floor(Num)\n", "cNum = math.ceil(Num)\n", "print \"original number %.2lf\"%Num\n", "print \"number rounded down %.lf\"%fNum\n", "print \"number rounded up %.lf\"%cNum" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "original number 123.54\n", "number rounded down 123\n", "number rounded up 124\n" ] } ], "prompt_number": 5 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }