summaryrefslogtreecommitdiff
path: root/Quantitative_Aptitude_for_Competitive_Examinations/Chapter13.ipynb
diff options
context:
space:
mode:
authorhardythe12015-06-03 15:27:17 +0530
committerhardythe12015-06-03 15:27:17 +0530
commitdf60071cf1d1c18822d34f943ab8f412a8946b69 (patch)
treeab059cf19bad4a1233a464ccf5d72cf8b3fb323c /Quantitative_Aptitude_for_Competitive_Examinations/Chapter13.ipynb
parentfba055ce5aa0955e22bac2413c33493b10ae6532 (diff)
downloadPython-Textbook-Companions-df60071cf1d1c18822d34f943ab8f412a8946b69.tar.gz
Python-Textbook-Companions-df60071cf1d1c18822d34f943ab8f412a8946b69.tar.bz2
Python-Textbook-Companions-df60071cf1d1c18822d34f943ab8f412a8946b69.zip
add books
Diffstat (limited to 'Quantitative_Aptitude_for_Competitive_Examinations/Chapter13.ipynb')
-rwxr-xr-xQuantitative_Aptitude_for_Competitive_Examinations/Chapter13.ipynb1048
1 files changed, 1048 insertions, 0 deletions
diff --git a/Quantitative_Aptitude_for_Competitive_Examinations/Chapter13.ipynb b/Quantitative_Aptitude_for_Competitive_Examinations/Chapter13.ipynb
new file mode 100755
index 00000000..306b8075
--- /dev/null
+++ b/Quantitative_Aptitude_for_Competitive_Examinations/Chapter13.ipynb
@@ -0,0 +1,1048 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# 13: Profit and Loss"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.1, Page number 13.6"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "loss in 1st case is 29 Rs\n",
+ "gain in 2nd case is 20 Rs\n",
+ "loss in 3rd case is 25.0 %\n",
+ "gain in 4th case is 25.0 %\n",
+ "SP in 5th case is 99.0 Rs\n",
+ "SP in 6th case is 15.0 Rs\n",
+ "CP in 7th case is 70.0 Rs\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "C1=125; #CP of 1st article(Rs)\n",
+ "S1=96; #SP of 1st article(Rs)\n",
+ "C2=112; #CP of 2nd article(Rs)\n",
+ "S2=132; #SP of 2nd article(Rs)\n",
+ "C3=120; #CP of 3rd article(Rs)\n",
+ "S3=90; #SP of 3rd article(Rs)\n",
+ "C4=80; #CP of 4th article(Rs)\n",
+ "S4=100; #SP of 4th article(Rs)\n",
+ "C5=90; #CP of 5th article(Rs)\n",
+ "G5=10; #gain(%)\n",
+ "L6=25; #loss(%)\n",
+ "C6=20; #CP of 6th article(Rs)\n",
+ "S7=84; #SP of 7th article(Rs)\n",
+ "G7=20; #gain(%)\n",
+ "\n",
+ "#Calculation\n",
+ "x1=S1-C1;\n",
+ "L1=-x1; #loss in 1st case(Rs)\n",
+ "x2=S2-C2;\n",
+ "G2=x2; #gain in 2nd case\n",
+ "x3=S3-C3;\n",
+ "L3=-x3*100/C3; #loss in 3rd case(%)\n",
+ "x4=S4-C4;\n",
+ "G4=x4*100/C4; #gain in 4th case(%)\n",
+ "S5=(100+G5)*C5/100; #SP in 5th case(Rs)\n",
+ "S6=(100-L6)*C6/100; #SP in 6th case(Rs)\n",
+ "C7=S7/(1+(G7*0.01)); #CP in 7th case(Rs) \n",
+ "\n",
+ "#Result\n",
+ "print \"loss in 1st case is\",L1,\"Rs\"\n",
+ "print \"gain in 2nd case is\",G2,\"Rs\"\n",
+ "print \"loss in 3rd case is\",L3,\"%\"\n",
+ "print \"gain in 4th case is\",G4,\"%\"\n",
+ "print \"SP in 5th case is\",S5,\"Rs\"\n",
+ "print \"SP in 6th case is\",S6,\"Rs\"\n",
+ "print \"CP in 7th case is\",C7,\"Rs\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.2, Page number 13.7"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "SP of 2nd article is 750.0 Rs\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "S1=450; #SP of 1st article(Rs)\n",
+ "x1=25; #loss(%)\n",
+ "x2=25; #gain(%)\n",
+ "\n",
+ "#Calculation\n",
+ "S2=S1*(100+x2)/(100-x1); #SP of 2nd article(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"SP of 2nd article is\",S2,\"Rs\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.3, Page number 13.7"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "gain in transaction is 25.0 %\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "n=25; #number of articles on CP\n",
+ "N=20; #number of articles on SP\n",
+ "\n",
+ "#Calculation\n",
+ "x=(n-N)*100/N; #gain in transaction(%)\n",
+ "\n",
+ "#Result\n",
+ "print \"gain in transaction is\",x,\"%\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.4, Page number 13.7"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "number of oranges per rupee is 32.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "S1=1/36; #SP of 1st article(Rs)\n",
+ "x1=4; #loss(%)\n",
+ "x2=8; #gain(%)\n",
+ "\n",
+ "#Calculation\n",
+ "S2=S1*(100+x2)/(100-x1); #SP of 2nd article(Rs)\n",
+ "n=1/S2; #number of oranges per rupee\n",
+ " \n",
+ "#Result\n",
+ "print \"number of oranges per rupee is\",n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.5, Page number 13.7"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "sale rate of rice is Rs 50.0 per kg\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "q1=2; #quantity(kg)\n",
+ "q2=10; #quantity(kg)\n",
+ "C=600; #cost price(Rs)\n",
+ "\n",
+ "#Calculation\n",
+ "S=C/(q1+q2); #sale rate of rice(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"sale rate of rice is Rs\",S,\"per kg\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.6, Page number 13.8"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "gain is 11.0 %\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "S1=455; #SP of 1st article(Rs)\n",
+ "S2=555; #SP of 2nd article(Rs)\n",
+ "x1=9; #loss(%)\n",
+ "\n",
+ "#Calculation\n",
+ "x2=(S2*(100-x1)/S1)-100; #gain(%)\n",
+ "\n",
+ "#Result\n",
+ "print \"gain is\",x2,\"%\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.7, Page number 13.8"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "real profit is 25.0 %\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "p=20; #profit on SP(%)\n",
+ "\n",
+ "#Calculation\n",
+ "rp=p*100/(100-p); #real profit(%)\n",
+ "\n",
+ "#Result\n",
+ "print \"real profit is\",rp,\"%\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.8, Page number 13.8"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "real loss is 9.09 %\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "l=-10; #loss on SP(%)\n",
+ "\n",
+ "#Calculation\n",
+ "rl=-l*100/(100-l); #real loss(%)\n",
+ "\n",
+ "#Result\n",
+ "print \"real loss is\",round(rl,2),\"%\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.9, Page number 13.8"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "percentage increase of MP is 40.0 %\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "d=10; #discount(%)\n",
+ "g=26; #profit(%)\n",
+ "C=1; #assume\n",
+ "\n",
+ "#Calculation\n",
+ "x=C*(100+g)/(100-d); \n",
+ "M=(x-1)*100; #percentage increase of MP(%)\n",
+ "\n",
+ "#Result\n",
+ "print \"percentage increase of MP is\",M,\"%\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.10, Page number 13.8"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "gain is 8.0 %\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "S1=30; #SP of 1st article(Rs)\n",
+ "x1=20; #gain(%)\n",
+ "d=10/100; #discount\n",
+ "\n",
+ "#Calculation\n",
+ "S2=S1*(1-d); #SP of 2nd article(Rs)\n",
+ "x2=(S2*(100+x1)/S1)-100; #gain(%)\n",
+ "\n",
+ "#Result\n",
+ "print \"gain is\",x2,\"%\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.11, Page number 13.9"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "number of oranges per rupee is 14.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "x=40; #gain(%)\n",
+ "S=1/10; #SP of article(Rs)\n",
+ "\n",
+ "#Calculation\n",
+ "y=(x/100)+1;\n",
+ "C=S/y; #CP of article(Rs)\n",
+ "n=1/C; #number of oranges per rupee\n",
+ "\n",
+ "#Result\n",
+ "print \"number of oranges per rupee is\",n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.12, Page number 13.9"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "gain is 50.0 %\n",
+ "number of oranges is 312.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "SP=1/4; #SP of article\n",
+ "CP=1/6; #CP of article\n",
+ "tg=26; #total gain(Rs)\n",
+ "\n",
+ "#Calculation\n",
+ "g=(SP-CP)*100/CP; #gain(%)\n",
+ "x=tg/(SP-CP); #number of oranges\n",
+ "\n",
+ "#Result\n",
+ "print \"gain is\",g,\"%\"\n",
+ "print \"number of oranges is\",x"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.13, Page number 13.9"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "gain is 11.11 %\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "x=0;\n",
+ "Tw=1000; #true weight(kg)\n",
+ "Fw=900; #false weight(kg)\n",
+ "\n",
+ "#Calculation\n",
+ "G=(Tw*(100+x)/Fw)-100; #gain(%)\n",
+ "\n",
+ "#Result\n",
+ "print \"gain is\",round(G,2),\"%\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.14, Page number 13.9"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "false scale length is 78.26 cm\n",
+ "answer varies due to rounding off errors\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "Ts=100; #true scale(cm)\n",
+ "G=15; #gain(%)\n",
+ "x=10; #loss(%)\n",
+ "\n",
+ "#Calculation\n",
+ "l=Ts*(100-x)/(100+G); #false scale length(cm)\n",
+ "\n",
+ "#Result\n",
+ "print \"false scale length is\",round(l,2),\"cm\"\n",
+ "print \"answer varies due to rounding off errors\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.15, Page number 13.10"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "gain is 96.56 %\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",
+ "x1=25; #gain(%)\n",
+ "x2=-20; #loss(%)\n",
+ "\n",
+ "#Calculation\n",
+ "x=2*(100+x1)*(100+x2);\n",
+ "y=100+x1+100+x2;\n",
+ "g=(x/y)-1; #gain(%)\n",
+ "\n",
+ "#Result\n",
+ "print \"gain is\",round(g,2),\"%\"\n",
+ "print \"answer given in the book is wrong\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.16, Page number 13.10"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "overall loss is -1.44 %\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "x=12; #loss or gain(%)\n",
+ "\n",
+ "#Calculation\n",
+ "l=-(x/10)**2; #overall loss(%)\n",
+ "\n",
+ "#Result\n",
+ "print \"overall loss is\",l,\"%\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.17, Page number 13.10"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "cost price of 1st watch is 224.0 Rs\n",
+ "cost price of 2nd watch is 336.0 Rs\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "C1=10/100; #loss\n",
+ "C2=15/100; #profit\n",
+ "C=560; #cost(Rs)\n",
+ "\n",
+ "#Calculation\n",
+ "C1=C1*C/(C1+C2); #cost price of 1st watch(Rs)\n",
+ "C2=C-C1; #cost price of 2nd watch(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"cost price of 1st watch is\",C1,\"Rs\"\n",
+ "print \"cost price of 2nd watch is\",C2,\"Rs\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.18, Page number 13.11"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "cost price of book is 90.0 Rs\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "C1=100; #CP of book(Rs)\n",
+ "p1=20/100; #profit\n",
+ "C2=80; #assume 20% less\n",
+ "p2=25/100; #profit in 2nd case\n",
+ "d=18; #given difference(Rs)\n",
+ "\n",
+ "#Calculation\n",
+ "S1=C1*(1+p1); #selling price of book(Rs)\n",
+ "S2=C2*(1+p2); #selling price in 2nd case(Rs)\n",
+ "S=S1-S2; #difference when CP=100(Rs)\n",
+ "CP=d*C1/S; #cost price of book(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"cost price of book is\",CP,\"Rs\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.19, Page number 13.11"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 23,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "cost price of the book is 420.0 Rs\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "d=16; #discount(%)\n",
+ "M_S=80; #cost(Rs)\n",
+ "\n",
+ "#Calculation\n",
+ "S=(100-d)*M_S/d; #cost price of the book(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"cost price of the book is\",S,\"Rs\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.20, Page number 13.11"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 28,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "gain in transaction is 11.11 %\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "n=30; #number of articles on CP\n",
+ "N=27; #number of articles on SP\n",
+ "\n",
+ "#Calculation\n",
+ "x=(n-N)*100/N; #gain in transaction(%)\n",
+ "\n",
+ "#Result\n",
+ "print \"gain in transaction is\",round(x,2),\"%\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.21, Page number 13.12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 29,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "selling price of salt is 88.0 paise per kg\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "x=80; #quantity(kg)\n",
+ "y=20; #quantity(kg)\n",
+ "C=88; #cost price(Rs)\n",
+ "\n",
+ "#Calculation\n",
+ "S=C/(x+y); #selling price of salt(Rs)\n",
+ "\n",
+ "#Result\n",
+ "print \"selling price of salt is\",S*100,\"paise per kg\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.22, Page number 13.12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 30,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "profit on the article is 20.0 %\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "l=10; #loss(%)\n",
+ "f=3/4; #fraction \n",
+ "\n",
+ "#Calculation\n",
+ "SP=(100-l)/f; #ratio of SP to CP(%)\n",
+ "p=SP-100; #profit on the article(%)\n",
+ "\n",
+ "#Result\n",
+ "print \"profit on the article is\",p,\"%\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.23, Page number 13.12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 31,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "gain is 50.0 %\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "N=66; #length of cloth(m)\n",
+ "x=22; #gain in length(m)\n",
+ "\n",
+ "#Calculation\n",
+ "g=x*100/(N-x); #gain(%)\n",
+ "\n",
+ "#Result\n",
+ "print \"gain is\",g,\"%\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.24, Page number 13.12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 35,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "gain is 33.33 %\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "N=66; #length of cloth(m)\n",
+ "Y=22; #gain in length(m)\n",
+ "\n",
+ "#Calculation\n",
+ "g=Y*100/N; #gain(%)\n",
+ "\n",
+ "#Result\n",
+ "print \"gain is\",round(g,2),\"%\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example number 13.25, Page number 13.12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 36,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "loss is 25.0 %\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "x=-22; #loss in length(m)\n",
+ "N=66; #length of cloth(m)\n",
+ "\n",
+ "#Calculation\n",
+ "l=-x*100/(N-x); #loss(%)\n",
+ "\n",
+ "#Result\n",
+ "print \"loss is\",l,\"%\""
+ ]
+ }
+ ],
+ "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
+}