diff options
Diffstat (limited to 'Quantitative_Aptitude_for_Competitive_Examinations/Chapter8.ipynb')
-rwxr-xr-x | Quantitative_Aptitude_for_Competitive_Examinations/Chapter8.ipynb | 691 |
1 files changed, 691 insertions, 0 deletions
diff --git a/Quantitative_Aptitude_for_Competitive_Examinations/Chapter8.ipynb b/Quantitative_Aptitude_for_Competitive_Examinations/Chapter8.ipynb new file mode 100755 index 00000000..ad182efa --- /dev/null +++ b/Quantitative_Aptitude_for_Competitive_Examinations/Chapter8.ipynb @@ -0,0 +1,691 @@ +{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "#8: Partnership and Share"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example number 8.1, Page number 8.1"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "investment of A is 5000.0 Rs\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "A=12000; #investment of A and B(Rs)\n",
+ "P=1800; #profit(Rs)\n",
+ "Pa=750; #profit of A(Rs)\n",
+ "\n",
+ "#Calculation\n",
+ "ratio=Pa/(P-Pa); #ratio of investments\n",
+ "Ia=Pa*A/P; #investment of A(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"investment of A is\",Ia,\"Rs\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example number 8.2, Page number 8.2"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "profit share of A is 1500.0 Rs\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "Ca=10000; #capital of A(Rs)\n",
+ "na=12; #number of years\n",
+ "nb=4; #number of years\n",
+ "Cb=5000; #capital of B(Rs)\n",
+ "P=2000; #total profit(Rs)\n",
+ "\n",
+ "#Calculation\n",
+ "a=Ca*na;\n",
+ "b=Cb*(na-nb);\n",
+ "r=a/b; #ratio of profits\n",
+ "Pa=a*P/(a+b); #profit share of A(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"profit share of A is\",Pa,\"Rs\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example number 8.3, Page number 8.2"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "profit of A is 57.0 Rs\n",
+ "profit of B is 60.0 Rs\n",
+ "profit of C is 63.0 Rs\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "Ia=380; #investment of A(Rs)\n",
+ "Ib=400; #investment of B(Rs)\n",
+ "Ic=420; #investment of C(Rs)\n",
+ "P=180; #net profit(Rs)\n",
+ "\n",
+ "#Calculation\n",
+ "I=Ia+Ib+Ic; #total investment(Rs)\n",
+ "Pa=Ia*P/I; #profit of A(Rs)\n",
+ "Pb=Ib*P/I; #profit of B(Rs)\n",
+ "Pc=Ic*P/I; #profit of C(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"profit of A is\",Pa,\"Rs\"\n",
+ "print \"profit of B is\",Pb,\"Rs\"\n",
+ "print \"profit of C is\",Pc,\"Rs\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example number 8.4, Page number 8.2"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "profit of A is 64.0 Rs\n",
+ "profit of B is 76.5 Rs\n",
+ "profit of C is 67.5 Rs\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "Ca=320*4; #contribution of A for 4 months(Rs)\n",
+ "Cb=510*3; #contribution of B for 3 months(Rs)\n",
+ "Cc=270*5; #contribution on C for 5 months(Rs)\n",
+ "P=208; #net profit(Rs)\n",
+ "\n",
+ "#Calculation\n",
+ "C=Ca+Cb+Cc; #contribution of A,B,C(Rs)\n",
+ "Pa=Ca*P/C; #profit of A(Rs)\n",
+ "Pb=Cb*P/C; #profit of B(Rs)\n",
+ "Pc=Cc*P/C; #profit of C(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"profit of A is\",Pa,\"Rs\"\n",
+ "print \"profit of B is\",Pb,\"Rs\"\n",
+ "print \"profit of C is\",Pc,\"Rs\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example number 8.5, Page number 8.2"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "profit of B is 420.0 Rs\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "C=8200; #total capital(Rs)\n",
+ "a=1000;\n",
+ "b=2000;\n",
+ "Cb=(C-(b+a+a))/3; #capital of B(Rs)\n",
+ "P=2460; #total profit(Rs)\n",
+ "\n",
+ "#Calculation\n",
+ "Pb=Cb*P/C; #profit of B(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"profit of B is\",Pb,\"Rs\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 8.6, Page number 8.3"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "C must pay Rs 10.0 to A\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "m=50; #amount with each person(Rs)\n",
+ "mA=20; #amount left with A(Rs)\n",
+ "mB=30; #amount left with B(Rs)\n",
+ "mC=40; #amount left with C(Rs)\n",
+ "\n",
+ "#Calculation\n",
+ "Ms=m*3; #total amount started with(Rs)\n",
+ "Mr=mA+mB+mC; #total amount ending with(Rs)\n",
+ "M=Mr/3; #amount each person must have(Rs)\n",
+ "Cm=mC-M; #C must pay(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"C must pay Rs\",Cm,\"to A\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 8.7, Page number 8.3"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "share of C is 240.0 Rs\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "a=1290; #amount(Rs)\n",
+ "A=3; #value of A in the ratio A:B\n",
+ "B1=2; #value of B in the ratio A:B \n",
+ "B2=7; #value of B in the ratio B:C\n",
+ "C1=4; #value of C in the ratio B:C\n",
+ "\n",
+ "#Calculation\n",
+ "#inorder to make the value of B in the ratios same, multiply by B2\n",
+ "A=A*B2;\n",
+ "B=B1*B2;\n",
+ "C=C1*B1; #new values of the ratio A:B:C\n",
+ "Sc=C*a/(A+B+C); #share of C(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"share of C is\",Sc,\"Rs\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 8.8, Page number 8.3"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "balance profit of B is 360.0 Rs\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "A=390; #amount A receives(Rs)\n",
+ "Ap=10*12; #profit for A(Rs)\n",
+ "Ia=3000; #investment of A(Rs)\n",
+ "Ib=4000; #investment of B(Rs)\n",
+ "\n",
+ "#Calculation\n",
+ "Ba=A-Ap; #balance profit of A(Rs)\n",
+ "Bb=Ba*Ib/Ia; #balance profit of B(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"balance profit of B is\",Bb,\"Rs\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 8.9, Page number 8.3"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "total amount of money is 200 Rs\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "BplusC=100; #amount with B and C(Rs)\n",
+ "AplusC=150; #amount with A and C(Rs)\n",
+ "\n",
+ "#Calculation\n",
+ "B=AplusC-BplusC; #amount with B(Rs)\n",
+ "ABC=AplusC+B; #total amount of money(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"total amount of money is\",ABC,\"Rs\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 8.10, Page number 8.4"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "profit share of A is 330.0 Rs\n",
+ "profit share of B is 430.0 Rs\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "A=760; #amount(Rs)\n",
+ "Ar=4; #part of A in ratio\n",
+ "Br=5; #part of B in ratio\n",
+ "At=3; #time for A(months)\n",
+ "AT=10-3; #ending time(months)\n",
+ "\n",
+ "#Calculation\n",
+ "MEI_A=(Ar*At)+(AT*Ar*At/Ar); #monthly equivalent investment of A\n",
+ "MEI_B=(Br*At)+(AT*Br*Ar/Br); #monthly equivalent investment of B\n",
+ "PA=MEI_A*A/(MEI_A+MEI_B); #profit share of A(Rs)\n",
+ "PB=MEI_B*A/(MEI_A+MEI_B); #profit share of B(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"profit share of A is\",PA,\"Rs\"\n",
+ "print \"profit share of B is\",PB,\"Rs\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 8.11, Page number 8.4"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "payment for rent by A is 8550.0 Rs\n",
+ "payment for rent by B is 5950.0 Rs\n",
+ "payment for rent by C is 9200.0 Rs\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "Fd_A=27; #floppy disks of A\n",
+ "Ad=19; #number of days for A\n",
+ "Fd_B=21; #floppy disks of B\n",
+ "Bd=17; #number of days for B\n",
+ "Fd_C=24; #floppy disks of C\n",
+ "Cd=23; #number of days for C\n",
+ "am=23700; #amount(Rs)\n",
+ "\n",
+ "#Calculation\n",
+ "A=Fd_A*Ad; #A's floppy days\n",
+ "B=Fd_B*Bd; #B's floppy days\n",
+ "C=Fd_C*Cd; #C's floppy days\n",
+ "PA=A*am/(A+B+C); #payment for rent by A(Rs)\n",
+ "PB=B*am/(A+B+C); #payment for rent by B(Rs)\n",
+ "PC=C*am/(A+B+C); #payment for rent by C(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"payment for rent by A is\",PA,\"Rs\"\n",
+ "print \"payment for rent by B is\",PB,\"Rs\"\n",
+ "print \"payment for rent by C is\",PC,\"Rs\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 8.12, Page number 8.4"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "capital of A is 3000.0 Rs\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "S=1000; #share of A(Rs)\n",
+ "IA=8; #investment of A(months)\n",
+ "IB=12; #investment of B(months)\n",
+ "PA=PB=1; \n",
+ "\n",
+ "#Calculation\n",
+ "CA=(PA/PB)*S*(IB/(IA/2)); #capital of A(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"capital of A is\",CA,\"Rs\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 8.13, Page number 8.5"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "total profit is 1000.0 Rs\n",
+ "answer given in the book is wrong\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "Sa=4000; #A's share(s)\n",
+ "Sb=5000; #B's share(Rs)\n",
+ "Sc=6000; #C's share(Rs)\n",
+ "r=1000; #ratio fraction\n",
+ "p=75/100; #profit percentage(%)\n",
+ "P=25/100;\n",
+ "A=100; #A gets less(Rs)\n",
+ "\n",
+ "#Calculation\n",
+ "TP=((Sa/r)+(Sb/r)+(Sc/r))/p; #total profit\n",
+ "As=(Sa/r)+(P*TP); #share of A\n",
+ "Bs=Sb/r; #share of B\n",
+ "Cs=Sc/r; #share of C\n",
+ "x=A/((Bs+Cs)-As);\n",
+ "Tp=TP*x; #total profit(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"total profit is\",Tp,\"Rs\"\n",
+ "print \"answer given in the book is wrong\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 8.14, Page number 8.5"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "total profit is 393.75 Rs\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "AP40=1250; #A's 40% profit(Rs)\n",
+ "BP40=850; #B's 40% profit(Rs)\n",
+ "A=30; #amount received more(Rs)\n",
+ "p=60/100; #distributed profit(%)\n",
+ "\n",
+ "#Calculation\n",
+ "R=(AP40+BP40)/(AP40-BP40); #applying componendo dividendo\n",
+ "P=R*A/(1-p); #total profit(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"total profit is\",P,\"Rs\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 8.15, Page number 8.5"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "share of A is 100.0 Rs\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "CA=1/6; #capital of A\n",
+ "CB=1/3; #capital of B\n",
+ "P=2300; #total profit(Rs)\n",
+ "\n",
+ "#Calculation\n",
+ "CC=1-CA-CB; #capital of C\n",
+ "PA=CA*CA*12; #A's profit\n",
+ "PB=CB*CB*12; #B's profit\n",
+ "PC=CC*12; #C's profit\n",
+ "SA=PA*P/(PA+PB+PC); #share of A(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"share of A is\",SA,\"Rs\""
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 2",
+ "language": "python",
+ "name": "python2"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 2
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython2",
+ "version": "2.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
|