From 0cf7b7cac26f26e99eb7ae00e903a5fc01968f00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milaan=20Parmar=20/=20=20=D0=9C=D0=B8=D0=BB=D0=B0=D0=BD=20?= =?UTF-8?q?=D0=BF=D0=B0=D1=80=D0=BC=D0=B0=D1=80=20/=20=5F=E7=B1=B3?= =?UTF-8?q?=E5=85=B0=20=E5=B8=95=E5=B0=94=E9=A9=AC?= Date: Wed, 25 Aug 2021 00:00:41 +0530 Subject: [PATCH] Add files via upload --- ...um n and print the series 1+2+...+n=.ipynb | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 11 read a num n and print the series 1+2+...+n=.ipynb diff --git a/11 read a num n and print the series 1+2+...+n=.ipynb b/11 read a num n and print the series 1+2+...+n=.ipynb new file mode 100644 index 0000000..b672fd0 --- /dev/null +++ b/11 read a num n and print the series 1+2+...+n=.ipynb @@ -0,0 +1,138 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n", + "All the IPython Notebooks in this example series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/90_Python_Examples)**\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter a number: 5\n", + "1 + 2 + 3 + 4 + 5 = 15\n", + "\n" + ] + }, + { + "data": { + "text/plain": [ + "'\\n>>Output/Runtime Test Cases\\n \\nCase 1:\\nEnter a number: 4\\n1 + 2 + 3 + 4 = 10\\n \\nCase 2:\\nEnter a number: 5\\n1 + 2 + 3 + 4 + 5 = 15\\n'" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Here is source code of the Python Program to ...\n", + "# The program output is also shown below.\n", + "\n", + "n=int(input(\"Enter a number: \"))\n", + "a=[]\n", + "for i in range(1,n+1):\n", + " print(i,sep=\" \",end=\" \")\n", + " if(i>Output/Runtime Test Cases\n", + " \n", + "Case 1:\n", + "Enter a number: 4\n", + "1 + 2 + 3 + 4 = 10\n", + " \n", + "Case 2:\n", + "Enter a number: 5\n", + "1 + 2 + 3 + 4 + 5 = 15\n", + "'''" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "hide_input": false, + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.8" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": true, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "Contents", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": false + }, + "varInspector": { + "cols": { + "lenName": 16, + "lenType": 16, + "lenVar": 40 + }, + "kernels_config": { + "python": { + "delete_cmd_postfix": "", + "delete_cmd_prefix": "del ", + "library": "var_list.py", + "varRefreshCmd": "print(var_dic_list())" + }, + "r": { + "delete_cmd_postfix": ") ", + "delete_cmd_prefix": "rm(", + "library": "var_list.r", + "varRefreshCmd": "cat(var_dic_list()) " + } + }, + "types_to_exclude": [ + "module", + "function", + "builtin_function_or_method", + "instance", + "_Feature" + ], + "window_display": false + } + }, + "nbformat": 4, + "nbformat_minor": 4 +}