{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 2: Syntactic Aspects"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1, Page number: 39"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Calculation and result\n",
      "class color() :\n",
      "   RED = 5\n",
      "   YELLOW = 6\n",
      "   GREEN = 4\n",
      "   BLUE = 5\n",
      "\n",
      "print ('RED = %d ' % color.RED)\n",
      "print ('YELLOW = %d ' % color.YELLOW)\n",
      "print ('GREEN = %d ' % color.GREEN)\n",
      "print ('BLUE = %d ' % color.BLUE)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "RED = 5 \n",
        "YELLOW = 6 \n",
        "GREEN = 4 \n",
        "BLUE = 5 \n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2, Page number: 41"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Calculation and result\n",
      "i = 2004\n",
      "c = 'Year'\n",
      "\n",
      "print ('%s %d' % (c, i))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Year 2004\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.1, Page number: 44"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Calculation and result\n",
      "num = 5\n",
      "c = '$'\n",
      "pi = 3.141\n",
      "print ('Hello World')\n",
      "print ('%d %c %f' % (num, c, pi))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Hello World\n",
        "5 $ 3.141000\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.2, Page number: 45"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Calculation and result\n",
      "num = int(raw_input('Enter your favorite number '))\n",
      "print ('You have entered your favorite number as %d ' % num)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "name": "stdout",
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Enter your favorite number 3\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "You have entered your favorite number as 3 \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.3, Page number: 60"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Calculation and result\n",
      "fahrenheit = float(raw_input('Please enter the Fahrenheit temperature '))\n",
      "\n",
      "centigrade = float(5)/9 * (fahrenheit - 32)\n",
      "\n",
      "print ('The temperature in Centigrade is %.2f ' % centigrade)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "name": "stdout",
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Please enter the Fahrenheit temperature 100\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The temperature in Centigrade is 37.78 \n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}