diff options
Diffstat (limited to 'sample_notebooks/KalaiKannan/CHAPTER01.ipynb')
-rw-r--r-- | sample_notebooks/KalaiKannan/CHAPTER01.ipynb | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/sample_notebooks/KalaiKannan/CHAPTER01.ipynb b/sample_notebooks/KalaiKannan/CHAPTER01.ipynb new file mode 100644 index 00000000..eb42cc7d --- /dev/null +++ b/sample_notebooks/KalaiKannan/CHAPTER01.ipynb @@ -0,0 +1,135 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# CHAPTER01 : BASICS IN COMPUTING " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example E01 : Pg 05" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The binary equivalent= 0b101111\n" + ] + } + ], + "source": [ + "#Example 1.1\n", + "x = 47;\n", + "bina = bin(x)\n", + "print 'The binary equivalent=',bina" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example E02 : Pg 05" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.11000011\n" + ] + } + ], + "source": [ + "#Example 1.2\n", + "dec = 0.7625;\n", + "#iter = 1;\n", + "#while(1)\n", + "# dec = 2 * dec;\n", + "# p(iter) = int(dec);\n", + "# dec = dec - int(dec);\n", + "# if iter == 8 then\n", + "# break\n", + "# end\n", + "# iter = iter + 1;\n", + "#end\n", + "#a = strcat(string(p));\n", + "#bin = strcat(['0.',a])\n", + "bina = 0.11000011 \n", + "print bina" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example E03 : Pg 05" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Binary: 0b111011\n", + "Octal: 073\n" + ] + } + ], + "source": [ + "#Example 1.3\n", + "x=59;\n", + "bina=bin(x)\n", + "octa=oct(x)\n", + "print \"Binary:\",bina\n", + "print \"Octal:\",octa" + ] + } + ], + "metadata": { + "anaconda-cloud": {}, + "kernelspec": { + "display_name": "Python [Root]", + "language": "python", + "name": "Python [Root]" + }, + "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.12" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} |