|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "<small><small><i>\n", |
| 8 | + "All the IPython Notebooks in this example series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/90_Python_Examples)**\n", |
| 9 | + "</i></small></small>" |
| 10 | + ] |
| 11 | + }, |
| 12 | + { |
| 13 | + "cell_type": "code", |
| 14 | + "execution_count": 17, |
| 15 | + "metadata": {}, |
| 16 | + "outputs": [ |
| 17 | + { |
| 18 | + "name": "stdout", |
| 19 | + "output_type": "stream", |
| 20 | + "text": [ |
| 21 | + "Enter a number: 6\n", |
| 22 | + "1 0 0 0 0 0 \n", |
| 23 | + "0 1 0 0 0 0 \n", |
| 24 | + "0 0 1 0 0 0 \n", |
| 25 | + "0 0 0 1 0 0 \n", |
| 26 | + "0 0 0 0 1 0 \n", |
| 27 | + "0 0 0 0 0 1 \n" |
| 28 | + ] |
| 29 | + }, |
| 30 | + { |
| 31 | + "data": { |
| 32 | + "text/plain": [ |
| 33 | + "'\\n>>Output/Runtime Test Cases\\n \\nCase 1:\\nEnter a number: 4\\n1 0 0 0 \\n0 1 0 0 \\n0 0 1 0 \\n0 0 0 1 \\n \\nCase 2:\\nEnter a number: 5\\n1 0 0 0 0 \\n0 1 0 0 0 \\n0 0 1 0 0 \\n0 0 0 1 0 \\n0 0 0 0 1\\n'" |
| 34 | + ] |
| 35 | + }, |
| 36 | + "execution_count": 17, |
| 37 | + "metadata": {}, |
| 38 | + "output_type": "execute_result" |
| 39 | + } |
| 40 | + ], |
| 41 | + "source": [ |
| 42 | + "# Here is source code of the Python Program to ...\n", |
| 43 | + "# The program output is also shown below.\n", |
| 44 | + "\n", |
| 45 | + "n=int(input(\"Enter a number: \"))\n", |
| 46 | + "for i in range(0,n):\n", |
| 47 | + " for j in range(0,n):\n", |
| 48 | + " if(i==j):\n", |
| 49 | + " print(\"1\",sep=\" \",end=\" \")\n", |
| 50 | + " else:\n", |
| 51 | + " print(\"0\",sep=\" \",end=\" \")\n", |
| 52 | + " print()\n", |
| 53 | + "\n", |
| 54 | + "\n", |
| 55 | + "'''\n", |
| 56 | + ">>Output/Runtime Test Cases\n", |
| 57 | + " \n", |
| 58 | + "Case 1:\n", |
| 59 | + "Enter a number: 4\n", |
| 60 | + "1 0 0 0 \n", |
| 61 | + "0 1 0 0 \n", |
| 62 | + "0 0 1 0 \n", |
| 63 | + "0 0 0 1 \n", |
| 64 | + " \n", |
| 65 | + "Case 2:\n", |
| 66 | + "Enter a number: 5\n", |
| 67 | + "1 0 0 0 0 \n", |
| 68 | + "0 1 0 0 0 \n", |
| 69 | + "0 0 1 0 0 \n", |
| 70 | + "0 0 0 1 0 \n", |
| 71 | + "0 0 0 0 1\n", |
| 72 | + "'''" |
| 73 | + ] |
| 74 | + }, |
| 75 | + { |
| 76 | + "cell_type": "code", |
| 77 | + "execution_count": null, |
| 78 | + "metadata": {}, |
| 79 | + "outputs": [], |
| 80 | + "source": [] |
| 81 | + } |
| 82 | + ], |
| 83 | + "metadata": { |
| 84 | + "hide_input": false, |
| 85 | + "kernelspec": { |
| 86 | + "display_name": "Python 3", |
| 87 | + "language": "python", |
| 88 | + "name": "python3" |
| 89 | + }, |
| 90 | + "language_info": { |
| 91 | + "codemirror_mode": { |
| 92 | + "name": "ipython", |
| 93 | + "version": 3 |
| 94 | + }, |
| 95 | + "file_extension": ".py", |
| 96 | + "mimetype": "text/x-python", |
| 97 | + "name": "python", |
| 98 | + "nbconvert_exporter": "python", |
| 99 | + "pygments_lexer": "ipython3", |
| 100 | + "version": "3.8.8" |
| 101 | + }, |
| 102 | + "toc": { |
| 103 | + "base_numbering": 1, |
| 104 | + "nav_menu": {}, |
| 105 | + "number_sections": true, |
| 106 | + "sideBar": true, |
| 107 | + "skip_h1_title": false, |
| 108 | + "title_cell": "Table of Contents", |
| 109 | + "title_sidebar": "Contents", |
| 110 | + "toc_cell": false, |
| 111 | + "toc_position": {}, |
| 112 | + "toc_section_display": true, |
| 113 | + "toc_window_display": false |
| 114 | + }, |
| 115 | + "varInspector": { |
| 116 | + "cols": { |
| 117 | + "lenName": 16, |
| 118 | + "lenType": 16, |
| 119 | + "lenVar": 40 |
| 120 | + }, |
| 121 | + "kernels_config": { |
| 122 | + "python": { |
| 123 | + "delete_cmd_postfix": "", |
| 124 | + "delete_cmd_prefix": "del ", |
| 125 | + "library": "var_list.py", |
| 126 | + "varRefreshCmd": "print(var_dic_list())" |
| 127 | + }, |
| 128 | + "r": { |
| 129 | + "delete_cmd_postfix": ") ", |
| 130 | + "delete_cmd_prefix": "rm(", |
| 131 | + "library": "var_list.r", |
| 132 | + "varRefreshCmd": "cat(var_dic_list()) " |
| 133 | + } |
| 134 | + }, |
| 135 | + "types_to_exclude": [ |
| 136 | + "module", |
| 137 | + "function", |
| 138 | + "builtin_function_or_method", |
| 139 | + "instance", |
| 140 | + "_Feature" |
| 141 | + ], |
| 142 | + "window_display": false |
| 143 | + } |
| 144 | + }, |
| 145 | + "nbformat": 4, |
| 146 | + "nbformat_minor": 4 |
| 147 | +} |
0 commit comments