diff options
author | hardythe1 | 2015-06-11 17:31:11 +0530 |
---|---|---|
committer | hardythe1 | 2015-06-11 17:31:11 +0530 |
commit | 79c59acc7af08ede23167b8455de4b716f77601f (patch) | |
tree | 2d6ff34b6f131d2671e4c6b798f210b3cb1d4ac7 /Computer_Concepts_and_C_Programming_by_R.Rajaram/chapter6_2.ipynb | |
parent | df60071cf1d1c18822d34f943ab8f412a8946b69 (diff) | |
download | Python-Textbook-Companions-79c59acc7af08ede23167b8455de4b716f77601f.tar.gz Python-Textbook-Companions-79c59acc7af08ede23167b8455de4b716f77601f.tar.bz2 Python-Textbook-Companions-79c59acc7af08ede23167b8455de4b716f77601f.zip |
add books
Diffstat (limited to 'Computer_Concepts_and_C_Programming_by_R.Rajaram/chapter6_2.ipynb')
-rwxr-xr-x | Computer_Concepts_and_C_Programming_by_R.Rajaram/chapter6_2.ipynb | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/Computer_Concepts_and_C_Programming_by_R.Rajaram/chapter6_2.ipynb b/Computer_Concepts_and_C_Programming_by_R.Rajaram/chapter6_2.ipynb new file mode 100755 index 00000000..4c020690 --- /dev/null +++ b/Computer_Concepts_and_C_Programming_by_R.Rajaram/chapter6_2.ipynb @@ -0,0 +1,161 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:47d59a62b2c6bacca8aa43f556c3c49e598b6b0b52b3cecb75f5587ebd7d9f66"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "6:CONSTANTS,VARIABLES"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "6.3.1,page number:140"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "m=4\n",
+ "n=6\n",
+ "p=8\n",
+ "result = m+n\n",
+ "print \"m+n=\",result\n",
+ "result = int (m/n)\n",
+ "print \"m/n=\",result\n",
+ "result = m*p\n",
+ "print \"m*p=\",result"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "m+n= 10\n",
+ "m/n= 0\n",
+ "m*p= 32\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "6.3.2,page number:141"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "m = 4\n",
+ "n = 6\n",
+ "p = 8\n",
+ "result= round(m+n-p*m+p/n,0)\n",
+ "print \"m=\",m,\",n=\",n,\",p=\",p\n",
+ "print \"m + n - p * m + p / n = \",result"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "m= 4 ,n= 6 ,p= 8\n",
+ "m + n - p * m + p / n = -21.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "6.3.3,page number:142"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "m = 4\n",
+ "n = 6\n",
+ "print \" 6 mod 4 = \",n%m\n",
+ "print \"The modulus operator is : %\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " 6 mod 4 = 2\n",
+ "The modulus operator is : %\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "6.3.4,page number:142"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "m = -4\n",
+ "n = 6\n",
+ "p = 8\n",
+ "print \"m=\",m,\" n=\",n,\" p=\",p\n",
+ "print \"gives\"\n",
+ "m=-m\n",
+ "n=-n\n",
+ "p=-p\n",
+ "print \"m=\",m,\" n=\",n,\" p=\",p"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "m= -4 n= 6 p= 8\n",
+ "gives\n",
+ "m= 4 n= -6 p= -8\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |