{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 3:Mass Relationships in Chemical Reactions"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:3.1,Page no:81"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Cu63=69.09 #percent of Cu 62.93 amu\n",
      "Cu65=30.91 #percent of Cu 64.9278 amu\n",
      "\n",
      "#Calculation\n",
      "AverageAMU=62.93*Cu63/100+64.9278*Cu65/100 # average amu\n",
      "\n",
      "#Result\n",
      "print\"The average atomic mass of Copper is :\",round(AverageAMU,2),\"amu\\n\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The average atomic mass of Copper is : 63.55 amu\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:3.2,Page no:84"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "mass=6.46 #mass of He, g\n",
      "\n",
      "#Calculation\n",
      "moles=mass/4.003 #no. of moles of He, as mol. mass of He is 4.003 amu\n",
      "\n",
      "#Result\n",
      "print\"The no. of moles of He is :\",round(moles,2),\"mol He\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The no. of moles of He is : 1.61 mol He\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:3.3,Page no:84"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "moles=0.356 #moles of Zn\n",
      "\n",
      "#Calculation\n",
      "mass=moles*65.39 #mass of Zn, g, 1 mole=65.39 g\n",
      "\n",
      "#Result\n",
      "print\"The mass of Zn is :\",round(mass,1),\"g Zn\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The mass of Zn is : 23.3 g Zn\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:3.4,Page no:84"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Na=6.022*10**23 # Avogadro number, atoms/mol\n",
      "mass=16.3 #mass of sulfur, g\n",
      "\n",
      "\n",
      "#Calculation\n",
      "moles=mass/32.07 #moles of S\n",
      "atoms=moles*Na #number of atoms of S\n",
      "\n",
      "#Result\n",
      "print\"The no. of atoms of S is :%.2e\"%atoms,\"S atoms\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The no. of atoms of S is :3.06e+23 S atoms\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:3.5,Page no:86"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "MassO=16.0 #mass of O, amu\n",
      "MassS=32.07 #mass of S, amu\n",
      "MassN=14.01 #mass of N, amu\n",
      "MassH=1.008 #mass of H, amu\n",
      "MassC=12.01 #mass of C, amu\n",
      "\n",
      "#Calculation\n",
      "#(a)\n",
      "MassSO2=MassS+MassO*2 #mass of SO2, amu\n",
      "#(b)\n",
      "MassC8H10N4O2=8*MassC+10*MassH+4*MassN+2*MassO \n",
      "\n",
      "#Result\n",
      "print\"(a).The molecular mass of SO2 is :\",MassSO2,\"amu\\n\"\n",
      "print\"(b).The molecular mass of C8H10N4O2 is :\",MassC8H10N4O2,\"amu\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a).The molecular mass of SO2 is : 64.07 amu\n",
        "\n",
        "(b).The molecular mass of C8H10N4O2 is : 194.2 amu\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:3.6,Page no:86"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Mass=6.07 #mass of CH4, g\n",
      "MassC=12.01 #mol. mass of C, amu\n",
      "MassH=1.008 #mol. mass of H, amu\n",
      "\n",
      "#Calculation\n",
      "MassCH4=MassC+4*MassH #mol. mass of CH4, amu\n",
      "Moles=Mass/MassCH4 #no. of moles of CH4\n",
      "\n",
      "#Result\n",
      "print\"The no. of moles of CH4 is :\",round(Moles,3),\"mol CH4\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The no. of moles of CH4 is : 0.378 mol CH4\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:3.7,Page no:87"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Na=6.07*10**23 # Avogadro number, atoms/mol\n",
      "Mass=25.6 #mass of Urea, g\n",
      "MolMass=60.06 #mol. mass of Urea, g\n",
      "\n",
      "#Calculation\n",
      "moles=Mass/MolMass #moles of Urea, mol\n",
      "Atoms=moles*Na*4 #No. of atoms of Hydrogen\n",
      "\n",
      "#Result\n",
      "print\"The no. of atoms of hydrogen are :%.2e\"%Atoms,\"H atoms\\n\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The no. of atoms of hydrogen are :1.03e+24 H atoms\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:3.8,Page no:89"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "H=1.008 #molar mass of H, g\n",
      "P=30.97 #molar mass of P, g\n",
      "O=16 #molar mass of O, g\n",
      "MolMass=97.99 #mol. mass of H3PO4, g\n",
      "\n",
      "#Calculation\n",
      "percentH=3*H/MolMass*100 #percent of H\n",
      "percentP=P/MolMass*100 #percent of P\n",
      "percentO=4*O/MolMass*100 #percent of O\n",
      "\n",
      "#Result\n",
      "print\"The percent by mass of Hydrogen is :\",round(percentH,3),\"%\\n\"\n",
      "print\"The percent by mass of Phosphorus is :\",round(percentP,2),\"%\\n\"\n",
      "print\"The percent by mass of Oxygen is :\",round(percentO,2),\"%\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The percent by mass of Hydrogen is : 3.086 %\n",
        "\n",
        "The percent by mass of Phosphorus is : 31.61 %\n",
        "\n",
        "The percent by mass of Oxygen is : 65.31 %\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:3.9,Page no:90"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "H=1.008 #molar mass of H, g\n",
      "C=12.01 #molar mass of C, g\n",
      "O=16.0 #molar mass of O, g\n",
      "percentC=40.92 #percent of C\n",
      "\n",
      "#Calculation\n",
      "nC=percentC/C \n",
      "percentH=4.58 #percent of H\n",
      "nH=percentH/H \n",
      "percentO=54.5 #percent of O\n",
      "nO=percentO/O \n",
      "if(nC>nH):# determining the smallest subscript\n",
      "    small=nH\n",
      "else:\n",
      "    small=nC \n",
      "    if(small>nO):\n",
      "        small=nO \n",
      "\n",
      "nC=nC/small #dividing by the smallest subscript\n",
      "nH=nH/small \n",
      "nO=nO/small \n",
      "#the approximate values of these variables are to be multiplied by appropriate number to make it an integer by trial and error method\n",
      "#in this case we need to multiply with 3 to get integer values\n",
      "nC=nC*3 \n",
      "nH=nH*3 \n",
      "nO=nO*3 \n",
      "\n",
      "#Result\n",
      "print\"The empirical formula of ascorbic acid is : C%.f\"%nC,\"H%.f\"%nH,\"O%.f\"%nO"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The empirical formula of ascorbic acid is : C3 H4 O3\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:3.10,Page no:91"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "massCuFeS2=3.71*10**3 #given mass of CuFeS2, kg\n",
      "CuFeS2=183.5 #mol. mass of CuFeS2, g\n",
      "Cu=63.55 #mol. mass of Cu, g\n",
      "\n",
      "#Calculation\n",
      "percentCu=Cu/CuFeS2*100 #percent Cu in CuFeS2\n",
      "massCu=percentCu*massCuFeS2/100#mass of Cu in given CuFeS2, kg\n",
      "\n",
      "#Result\n",
      "print\"The mass of Cu in CuFeS2 is :%.2e\"%massCu,\"kg\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The mass of Cu in CuFeS2 is :1.28e+03 kg\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:3.11,Page no:93"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "M_N=1.52      #Mass of nitrogen in g\n",
      "M_O=3.47      #Mass of oxygen in g\n",
      "N=14.01       #Atomic mass of N\n",
      "Molar1=95     #Molar mass in g \n",
      "O=16          #Atomic mass of O\n",
      "\n",
      "#Calculation\n",
      "n_N=M_N/N       #No of moles of N\n",
      "n_O=M_O/O       #No of moles of O\n",
      "emp=N+2*(O)     #Empirical molar massof NO2\n",
      "ratio=Molar1/emp\n",
      "ratio=round(ratio)\n",
      "actual=ratio*emp\n",
      "\n",
      "#Result\n",
      "print\"Molecular formula is N%.3g\"%n_N,\"O%.3g\"%n_O\n",
      "print \"Actual molar mass is\",actual,\"g,which is between 90 g and 95 g\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Molecular formula is N0.108 O0.217\n",
        "Actual molar mass is 92.02 g,which is between 90 g and 95 g\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:3.13,Page no:101"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "CO2=44.01 #mol. mass of CO2, g\n",
      "Glucose=180.2 #mol. mass of Glucose, g\n",
      "massGlucose=856 #given mass of Glucose, g\n",
      "\n",
      "#Calculation\n",
      "moleGlucose=massGlucose/Glucose # moles of glucose\n",
      "moleCO2=moleGlucose*6 #1 mole glucose gives 6 moles of CO2\n",
      "massCO2=moleCO2*CO2 # mass of CO2, g\n",
      "\n",
      "#Result\n",
      "print\"The mass of CO2 is :%.2e\"%massCO2,\"g CO2\\n\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The mass of CO2 is :1.25e+03 g CO2\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:3.14,Page no:102"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "H2=2.016 #mol. mass of H2, g\n",
      "Li=6.941 #mol. mass of Li, g\n",
      "mH2=9.89 #mass of H2, g\n",
      "\n",
      "#Calculation\n",
      "nH2=mH2/H2 #moles of H2\n",
      "nLi=2*nH2 #moles of Li, 1mol H2 given by 2mol Li\n",
      "mLi=Li*nLi ##mass of Li, g\n",
      "\n",
      "#Result\n",
      "print\"The mass of Li is :\",round(mLi,1),\"g Li\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The mass of Li is : 68.1 g Li\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:3.15,Page no:104"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Urea=60.06 #mol. mass of Urea, g\n",
      "NH3=17.03 #mol. mass of NH3, g\n",
      "CO2=44.01 #mol. mass of CO2, g\n",
      "\n",
      "#(a)\n",
      "#for NH3\n",
      "mNH3=637.2 #mass of NH3, g\n",
      "\n",
      "#Calculation\n",
      "nNH3=mNH3/NH3 #moles of NH3\n",
      "nUrea1=nNH3/2#moles of Urea\n",
      "#for CO2\n",
      "mCO2=1142#mol. mass of CO2, g\n",
      "nCO2=mCO2/CO2 #moles of CO2\n",
      "nUrea2=nCO2 #moles of Urea\n",
      "if(nUrea1>nUrea2): #finding limiting reagent\n",
      "    nUrea=nUrea2 \n",
      "    limiting=\"CO2\" \n",
      "else:\n",
      "    limiting=\"NH3\" \n",
      "    nUrea=nUrea1 \n",
      "    \n",
      "#Result\n",
      "print\"(a).The limiting reagent is :\",limiting\n",
      "#(b)\n",
      "mUrea=nUrea*Urea #mass of urea produced\n",
      "print\"(b).The mass of the Urea produced is :\",round(mUrea),\"g (NH2)2CO\"\n",
      "\n",
      "#(c)\n",
      "if(limiting==\"NH3\") :#finding excess reagent\n",
      "    nCO2excess=nCO2-nNH3/2 \n",
      "    mCO2excess=nCO2excess*CO2 \n",
      "    print\"(c).The mass of excess CO2 is :\",round(mCO2excess),\"g \\n\"\n",
      "else: \n",
      "    nNH3excess=nNH3-2*nCO2 \n",
      "    mNH3excess=nNH3excess*NH3 \n",
      "    print\"The mass of excess NH3 is :\",mNH3excess,\"g\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a).The limiting reagent is : NH3\n",
        "(b).The mass of the Urea produced is : 1124.0 g (NH2)2CO\n",
        "(c).The mass of excess CO2 is : 319.0 g \n",
        "\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:3.16,Page no:106"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#(a)\n",
      "#for TiCl4\n",
      "\n",
      "#Variable declaration\n",
      "mTiCl4=3.54*10**7 #mass of TiCl4, g\n",
      "nTiCl4=mTiCl4/189.7 #moles of TiCl4\n",
      "nTi1=nTiCl4*1.0 #moles of Ti\n",
      "\n",
      "#for Mg\n",
      "mMg=1.13*10**7 #mass of Mg, g\n",
      "nMg=mMg/24.31 #moles of Mg\n",
      "nTi2=nMg/2.0 #moles of Ti\n",
      "\n",
      "\n",
      "#Calculation\n",
      "if(nTi1>nTi2):   #finding imiting reagent\n",
      "     nTi=nTi2 \n",
      "else:\n",
      "    nTi=nTi1 \n",
      "    mTi=nTi*47.88 \n",
      "    print\"(a).The theoretical yield is :%.2e\"%mTi,\"g\\n\"\n",
      "    print\"\\nNOTE:Variation from answer due to approx value of mTi taken in book\\n\"\n",
      "\n",
      "#(b)\n",
      "\n",
      "mTiactual=7.91*10**6 #given, actual Ti produced\n",
      "p_yield=mTiactual/mTi*100.0 \n",
      "print\"(b).The percent yield is :\",round(p_yield,1),\"%\\n\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a).The theoretical yield is :8.93e+06 g\n",
        "\n",
        "\n",
        "NOTE:Variation from answer due to approx value of mTi taken in book\n",
        "\n",
        "(b).The percent yield is : 88.5 %\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 27
    }
   ],
   "metadata": {}
  }
 ]
}