{ "metadata": { "name": "", "signature": "sha256:a2f721b4c266424e2bea1224b09de694c0f19e61e65e603f28f9ade00148c17a" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Hour 4: Understanding Data Types and Keywords" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.1, Page No.60" ] }, { "cell_type": "code", "collapsed": false, "input": [ "c1='A'\n", "c2='a'\n", "\n", "print \"Convert the value of c1 to character : \",c1\n", "print \"Convert the value of c2 to character : \",c2" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Convert the value of c1 to character : A\n", "Convert the value of c2 to character : a\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.2, Page No.61" ] }, { "cell_type": "code", "collapsed": false, "input": [ "c1=65\n", "c2=97\n", "\n", "print \"The character that has numeric value of 65 is:\", chr(c1)\n", "print \"The character that has numeric value of 97 is:\", chr(c2)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The character that has numeric value of 65 is: A\n", "The character that has numeric value of 97 is: a\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.3, Page No.63" ] }, { "cell_type": "code", "collapsed": false, "input": [ "c1='A'\n", "c2='a'\n", "print \"The Numeric Value of A is:\",ord(c1)\n", "print \"The Numeric Value of a is:\",ord(c2)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The Numeric Value of A is: 65\n", "The Numeric Value of a is: 97\n" ] } ], "prompt_number": 7 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.4, Page No.65" ] }, { "cell_type": "code", "collapsed": false, "input": [ "int_num1=int(32/10)\n", "flt_num1=float(32/10)\n", "int_num2=int(32.0/10)\n", "flt_num2=float(32.0/10)\n", "int_num3=int(32/10.0)\n", "flt_num3=float(32/10.0)\n", "\n", "print \"The integer divis. of 32/10 is\",int_num1\n", "print \"The floating-point divis. of 32/10 is\",flt_num1\n", "\n", "print \"The integer divis. of 32.0/10 is\",int_num2\n", "print \"The floating-point divis. of 32.0/10 is\",flt_num2\n", "\n", "print \"The integer divis. of 32/10.0 is\",int_num3\n", "print \"The floating-point divis. of 32/10.0 is\",flt_num3" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The integer divis. of 32/10 is 3\n", "The floating-point divis. of 32/10 is 3.0\n", "The integer divis. of 32.0/10 is 3\n", "The floating-point divis. of 32.0/10 is 3.2\n", "The integer divis. of 32/10.0 is 3\n", "The floating-point divis. of 32/10.0 is 3.2\n" ] } ], "prompt_number": 10 } ], "metadata": {} } ] }