From 2f3cb2a39a624a39214fe4de72bba3d2f0b0c37b Mon Sep 17 00:00:00 2001 From: martin-raven Date: Tue, 2 Oct 2018 18:19:01 +0530 Subject: [PATCH 1/2] After First Session --- Python_Workshop_Level_1.ipynb | 1027 +++++++++++++++++++-------------- 1 file changed, 585 insertions(+), 442 deletions(-) diff --git a/Python_Workshop_Level_1.ipynb b/Python_Workshop_Level_1.ipynb index d6878bf..db6b923 100644 --- a/Python_Workshop_Level_1.ipynb +++ b/Python_Workshop_Level_1.ipynb @@ -1,461 +1,604 @@ { - "nbformat": 4, - "nbformat_minor": 0, - "metadata": { - "colab": { - "name": "Python Workshop Level 1", - "version": "0.3.2", - "provenance": [], - "include_colab_link": true - }, - "kernelspec": { - "name": "python3", - "display_name": "Python 3" - } + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "view-in-github" + }, + "source": [ + "[View in Colaboratory](https://colab.research.google.com/github/martin-raven/Python_Level_1/blob/master/Python_Workshop_Level_1.ipynb)" + ] }, - "cells": [ - { - "cell_type": "markdown", - "metadata": { - "id": "view-in-github", - "colab_type": "text" - }, - "source": [ - "[View in Colaboratory](https://colab.research.google.com/github/martin-raven/Python_Level_1/blob/master/Python_Workshop_Level_1.ipynb)" - ] - }, - { - "metadata": { - "id": "kRUpZl5kabzI", - "colab_type": "text" - }, - "cell_type": "markdown", - "source": [ - "![alt text](https://u.imageresize.org/v2/61003344-d43f-44b9-8703-067f07b6a5ba.jpeg)" - ] - }, - { - "metadata": { - "id": "ZcLm9AIAHZp3", - "colab_type": "text" - }, - "cell_type": "markdown", - "source": [ - "\n", - "\n", - "\n", - "![](https://s3.ap-south-1.amazonaws.com/workshoppython1/LOGO+IODev+ev+center+HQ.png)\n", - "# **Welcome to the Workshop By IODev on Python**\n", - "\n", - "![alt text](https://media1.tenor.com/images/0465c304389c5c779c2957fd65d01817/tenor.gif?itemid=12083183)\n", - "\n", - "\n", - "\n", - "\n" - ] - }, - { - "metadata": { - "id": "SzqEG2-EMIqZ", - "colab_type": "text" - }, - "cell_type": "markdown", - "source": [ - "---\n", - "\n", - "\n", - "\n", - "---\n", - "**Who are we**\n", - "\n", - "\n", - "---\n", - "\n", - "\n", - "\n", - "![alt text](https://i.imgur.com/4MkSCjC.jpg)\n" - ] - }, - { - "metadata": { - "id": "yzOr-kdIf0AA", - "colab_type": "text" - }, - "cell_type": "markdown", - "source": [ - "---\n", - "\n", - "\n", - "\n", - "---\n", - "## Why is python easier?\n", - "---\n", - "![alt text](https://qph.fs.quoracdn.net/main-qimg-4b668ad2c9f0185fc11c6eddeb0590cc-c)" - ] - }, - { - "metadata": { - "id": "Sa6PeXY6k9y4", - "colab_type": "text" - }, - "cell_type": "markdown", - "source": [ - "---\n", - "\n", - "\n", - "\n", - "---\n", - "# **What is not programming**\n", - "---\n", - "![alt text](https://media0.giphy.com/media/ZVik7pBtu9dNS/200.gif?cid=3640f6095bb253e44962756e771e3c14)" - ] - }, - { - "metadata": { - "id": "HMtCPMHc2bue", - "colab_type": "text" - }, - "cell_type": "markdown", - "source": [ - "---\n", - "\n", - "\n", - "\n", - "---\n", - "**Does learning python pay off**\n", - "---\n", - "\n", - "![alt text](http://www.codingdojo.com/blog/wp-content/uploads/2018-developer-job-listings-for-most-popular-programming-languages1.jpg)" - ] - }, - { - "metadata": { - "id": "rHRymecL26gv", - "colab_type": "text" - }, - "cell_type": "markdown", - "source": [ - "---\n", - "\n", - "\n", - "\n", - "---\n", - "**Who uses python?**\n", - "\n", - "\n", - "---\n", - "\n", - "\n", - "\n", - "![alt text](https://www.probytes.net/wp-content/uploads/2018/08/appl.png)" - ] - }, - { - "metadata": { - "id": "DVAu45zXIXwO", - "colab_type": "text" - }, - "cell_type": "markdown", - "source": [ - "![alt text](https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRhwVPVA4JdA45AcCm8HXsLnoPWRW7xICDK90ug7jZ9ToWWMApi)\n", - "\n", - "\n", - "**Appo Thudagam?**" - ] - }, - { - "metadata": { - "id": "qudp9h-b_lPw", - "colab_type": "code", - "colab": {} - }, - "cell_type": "code", - "source": [ - "# First Program\n" - ], - "execution_count": 0, - "outputs": [] - }, - { - "metadata": { - "id": "N2Q0FI12Ig4z", - "colab_type": "text" - }, - "cell_type": "markdown", - "source": [ - "Datatype enna sambhavam?\n", - "\n", - "\n", - "![alt text](http://i.ebayimg.com/00/s/NDgwWDQ4MA==/z/~H0AAOxyUrZS-txs/$_3.JPG?set_id=2)\n", - "\n", - "![alt text](https://images-na.ssl-images-amazon.com/images/I/41qNFgJqvVL._SY355_.jpg)" - ] - }, - { - "metadata": { - "id": "756cGMUS_9d1", - "colab_type": "code", - "colab": {} - }, - "cell_type": "code", - "source": [ - "# DataTypes" - ], - "execution_count": 0, - "outputs": [] - }, - { - "metadata": { - "id": "XfRCU_zrAEAk", - "colab_type": "code", - "colab": {} - }, - "cell_type": "code", - "source": [ - "# Variables\n", - "# int,float,str,boolean" - ], - "execution_count": 0, - "outputs": [] - }, - { - "metadata": { - "id": "6o8VWOsCAdyT", - "colab_type": "code", - "colab": {} - }, - "cell_type": "code", - "source": [ - "# List\n", - "# help(list)" - ], - "execution_count": 0, - "outputs": [] - }, - { - "metadata": { - "id": "8PhFKQ8mBWoH", - "colab_type": "code", - "colab": {} - }, - "cell_type": "code", - "source": [ - "# Set\n" - ], - "execution_count": 0, - "outputs": [] - }, - { - "metadata": { - "id": "6dQJ0sEpBXu_", - "colab_type": "code", - "colab": {} - }, - "cell_type": "code", - "source": [ - "# Dict" - ], - "execution_count": 0, - "outputs": [] - }, - { - "metadata": { - "id": "yHy7eU6cGGBh", - "colab_type": "text" - }, - "cell_type": "markdown", - "source": [ - "# Comments\n", - "\n", - "Comments are lines of code/text that is ignored by the interperter" - ] - }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "kRUpZl5kabzI" + }, + "source": [ + "![alt text](https://u.imageresize.org/v2/61003344-d43f-44b9-8703-067f07b6a5ba.jpeg)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "ZcLm9AIAHZp3" + }, + "source": [ + "\n", + "\n", + "\n", + "![](https://s3.ap-south-1.amazonaws.com/workshoppython1/LOGO+IODev+ev+center+HQ.png)\n", + "# **Welcome to the Workshop By IODev on Python**\n", + "\n", + "![alt text](https://media1.tenor.com/images/0465c304389c5c779c2957fd65d01817/tenor.gif?itemid=12083183)\n", + "\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "SzqEG2-EMIqZ" + }, + "source": [ + "---\n", + "\n", + "\n", + "\n", + "---\n", + "**Who are we**\n", + "\n", + "\n", + "---\n", + "\n", + "\n", + "\n", + "![alt text](https://i.imgur.com/4MkSCjC.jpg)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "yzOr-kdIf0AA" + }, + "source": [ + "---\n", + "\n", + "\n", + "\n", + "---\n", + "## Why is python easier?\n", + "---\n", + "![alt text](https://qph.fs.quoracdn.net/main-qimg-4b668ad2c9f0185fc11c6eddeb0590cc-c)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "Sa6PeXY6k9y4" + }, + "source": [ + "---\n", + "\n", + "\n", + "\n", + "---\n", + "# **What is not programming**\n", + "---\n", + "![alt text](https://media0.giphy.com/media/ZVik7pBtu9dNS/200.gif?cid=3640f6095bb253e44962756e771e3c14)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "HMtCPMHc2bue" + }, + "source": [ + "---\n", + "\n", + "\n", + "\n", + "---\n", + "**Does learning python pay off**\n", + "---\n", + "\n", + "![alt text](http://www.codingdojo.com/blog/wp-content/uploads/2018-developer-job-listings-for-most-popular-programming-languages1.jpg)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "rHRymecL26gv" + }, + "source": [ + "---\n", + "\n", + "\n", + "\n", + "---\n", + "**Who uses python?**\n", + "\n", + "\n", + "---\n", + "\n", + "\n", + "\n", + "![alt text](https://www.probytes.net/wp-content/uploads/2018/08/appl.png)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "DVAu45zXIXwO" + }, + "source": [ + "![alt text](https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRhwVPVA4JdA45AcCm8HXsLnoPWRW7xICDK90ug7jZ9ToWWMApi)\n", + "\n", + "\n", + "**Appo Thudagam?**" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "colab": {}, + "colab_type": "code", + "id": "qudp9h-b_lPw" + }, + "outputs": [ { - "metadata": { - "id": "IBADgahzGbJY", - "colab_type": "code", - "colab": { - "base_uri": "https://localhost:8080/", - "height": 53 - }, - "outputId": "a30a3cbc-1b5a-4e93-9c98-76dfa577440b" - }, - "cell_type": "code", - "source": [ - "#Ikka Mass Aaanu Mwone\n", - "print(\"Neee Po mwone dineshaa\")\n", - "\n", - "print(15*2+1)" - ], - "execution_count": 2, - "outputs": [ - { - "output_type": "stream", - "text": [ - "Neee Po mwone dineshaa\n", - "31\n" - ], - "name": "stdout" - } - ] - }, + "name": "stdout", + "output_type": "stream", + "text": [ + "66\n" + ] + } + ], + "source": [ + "# First Program\n", + "name=\"something\"\n", + "# type(7.0)\n", + "# print(1+1)\n", + "a=\"22\"\n", + "b=\"44\"\n", + "print(int(a)+int(b))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "N2Q0FI12Ig4z" + }, + "source": [ + "Datatype enna sambhavam?\n", + "\n", + "\n", + "![alt text](http://i.ebayimg.com/00/s/NDgwWDQ4MA==/z/~H0AAOxyUrZS-txs/$_3.JPG?set_id=2)\n", + "\n", + "![alt text](https://images-na.ssl-images-amazon.com/images/I/41qNFgJqvVL._SY355_.jpg)" + ] + }, + { + "cell_type": "code", + "execution_count": 0, + "metadata": { + "colab": {}, + "colab_type": "code", + "id": "756cGMUS_9d1" + }, + "outputs": [], + "source": [ + "# DataTypes" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "colab": {}, + "colab_type": "code", + "id": "XfRCU_zrAEAk" + }, + "outputs": [ { - "metadata": { - "id": "0Kaxg04GGjwR", - "colab_type": "text" - }, - "cell_type": "markdown", - "source": [ - "is a single line comment\n" + "data": { + "text/plain": [ + "bool" ] - }, + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Variables\n", + "# int,float,str,boolean\n", + "type(True)" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "colab": {}, + "colab_type": "code", + "id": "6o8VWOsCAdyT" + }, + "outputs": [ { - "metadata": { - "id": "A099cXtxGpMj", - "colab_type": "code", - "colab": { - "base_uri": "https://localhost:8080/", - "height": 35 - }, - "outputId": "407cbd13-b685-4042-8020-bf8c2b57c8a6" - }, - "cell_type": "code", - "source": [ - "\"\"\" Commondra Maheshee \n", - " You too can code daa \n", - "\"\"\"\n", - "print(\"sadhanam kayil undo?\")" - ], - "execution_count": 2, - "outputs": [ - { - "output_type": "stream", - "text": [ - "sadhanam kayil undo?\n" - ], - "name": "stdout" - } - ] - }, + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 2, 4]\n", + "(1, 2, 2, 4)\n" + ] + } + ], + "source": [ + "# List\n", + "# help(list)\n", + "test_list=[1,2,2,4]\n", + "print(test_list)\n", + "test_tuple=(1,2,2,4)\n", + "print(test_tuple)" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": { + "colab": {}, + "colab_type": "code", + "id": "8PhFKQ8mBWoH" + }, + "outputs": [ { - "metadata": { - "id": "1qBCHeI0HJXu", - "colab_type": "text" - }, - "cell_type": "markdown", - "source": [ - "is a multiline comment" - ] - }, + "name": "stdout", + "output_type": "stream", + "text": [ + "{1, 2}\n" + ] + } + ], + "source": [ + "# Set\n", + "test_set={1,2,2,2}\n", + "print(test_set)\n", + "\n", + "\n", + "\n", + "test_list=[1,2,2,4,4,4]\n", + "print(set(test_list))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": { + "colab": {}, + "colab_type": "code", + "id": "6dQJ0sEpBXu_" + }, + "outputs": [ { - "metadata": { - "id": "SZFQ6z1_O5Ul", - "colab_type": "text" - }, - "cell_type": "markdown", - "source": [ - "# Basic Operators Enthokke?\n", - "\n", - "\n", - "---\n", - "\n", - "# [Operators](https://www.geeksforgeeks.org/basic-operators-python/)\n" + "data": { + "text/plain": [ + "dict" ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Dict\n", + "type({\"dog\":[1,2,2],\"cat\":\"Another animal\"})" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "yHy7eU6cGGBh" + }, + "source": [ + "# Comments\n", + "\n", + "Comments are lines of code/text that is ignored by the interperter" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 53 }, + "colab_type": "code", + "id": "IBADgahzGbJY", + "outputId": "a30a3cbc-1b5a-4e93-9c98-76dfa577440b" + }, + "outputs": [ { - "metadata": { - "id": "pSRw3e2DWjXX", - "colab_type": "text" - }, - "cell_type": "markdown", - "source": [ - "# Operator Precedence Entha?\n", - "\n", - "---\n", - "# [Operator Precedence chart](http://www.tutorialspoint.com/python/operators_precedence_example.htm)\n" - ] + "name": "stdout", + "output_type": "stream", + "text": [ + "Neee Po mwone dineshaa\n", + "31\n" + ] + } + ], + "source": [ + "#Ikka Mass Aaanu Mwone\n", + "print(\"Neee Po mwone dineshaa\")\n", + "\n", + "print(15*2+1)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "0Kaxg04GGjwR" + }, + "source": [ + "is a single line comment\n" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 }, + "colab_type": "code", + "id": "A099cXtxGpMj", + "outputId": "407cbd13-b685-4042-8020-bf8c2b57c8a6" + }, + "outputs": [ { - "metadata": { - "id": "_LZwmrJ7OOUV", - "colab_type": "text" - }, - "cell_type": "markdown", - "source": [ - "\n", - "\n", - "---\n", - "\n", - "\n", - "\n", - "---\n", - "\n", - "\n", - "# Now we loop.\n", - "\n", - "\n", - "---\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "![alt text](https://media.giphy.com/media/fCU0PktW618D2VuXki/giphy.gif)\n", - "\n", - "## **3 Types of loops**\n", - "\n", - "* **While**\n", - "![alt text](http://www.mathwarehouse.com/programming/images/while_loop/top-5-programming-animated-gifs_demonstration-of-while-loop-animation_logo.gif)\n", - "* **Do while**\n", - "* **For**\n", - "\n" - ] - }, + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter the Age 101\n", + "Submit Medical Fitness Certificate\n" + ] + } + ], + "source": [ + "age = int(input(\"Enter the Age \"))\n", + "if age>=18 and age<90:\n", + " print(\"You are Elligible\")\n", + "elif age>=90:\n", + " print(\"Submit Medical Fitness Certificate\")\n", + "else:\n", + " print(\"Not Elligible\")" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "1qBCHeI0HJXu" + }, + "source": [ + "is a multiline comment" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "SZFQ6z1_O5Ul" + }, + "source": [ + "# Basic Operators Enthokke?\n", + "\n", + "\n", + "---\n", + "\n", + "# [Operators](https://www.geeksforgeeks.org/basic-operators-python/)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "pSRw3e2DWjXX" + }, + "source": [ + "# Operator Precedence Entha?\n", + "\n", + "---\n", + "# [Operator Precedence chart](http://www.tutorialspoint.com/python/operators_precedence_example.htm)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "_LZwmrJ7OOUV" + }, + "source": [ + "\n", + "\n", + "---\n", + "\n", + "\n", + "\n", + "---\n", + "\n", + "\n", + "# Now we loop.\n", + "\n", + "\n", + "---\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "![alt text](https://media.giphy.com/media/fCU0PktW618D2VuXki/giphy.gif)\n", + "\n", + "## **3 Types of loops**\n", + "\n", + "* **While**\n", + "![alt text](http://www.mathwarehouse.com/programming/images/while_loop/top-5-programming-animated-gifs_demonstration-of-while-loop-animation_logo.gif)\n", + "* **Do while**\n", + "* **For**\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 0, + "metadata": { + "colab": {}, + "colab_type": "code", + "id": "3bLBnZxlSveg" + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "k4MwgNC-TqCc" + }, + "source": [ + "---\n", + "\n", + "\n", + "\n", + "---\n", + "\n", + "# **Functions**\n", + "\n", + "---\n", + "![alt text](https://media1.tenor.com/images/aed8a9012f98c1f3b7a6e678c15ac829/tenor.gif?itemid=12071848)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": { + "colab": {}, + "colab_type": "code", + "id": "GnGu1GmubZqv" + }, + "outputs": [ { - "metadata": { - "id": "3bLBnZxlSveg", - "colab_type": "code", - "colab": {} - }, - "cell_type": "code", - "source": [ - "" - ], - "execution_count": 0, - "outputs": [] + "name": "stdout", + "output_type": "stream", + "text": [ + "enter a : 5\n", + "enter b : 7\n" + ] }, { - "metadata": { - "id": "k4MwgNC-TqCc", - "colab_type": "text" - }, - "cell_type": "markdown", - "source": [ - "---\n", - "\n", - "\n", - "\n", - "---\n", - "\n", - "# **Functions**\n", - "\n", - "---\n", - "![alt text](https://media1.tenor.com/images/aed8a9012f98c1f3b7a6e678c15ac829/tenor.gif?itemid=12071848)\n" + "data": { + "text/plain": [ + "12" ] - }, + }, + "execution_count": 65, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "def findsum(a,b):\n", + " if a.isdigit() and b.isdigit():\n", + " return int(a)+int(b)\n", + " else:\n", + " return \"either one or more are strings\"\n", + "findsum(input(\"enter a : \"), input(\"enter b : \"))" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": {}, + "outputs": [ { - "metadata": { - "id": "GnGu1GmubZqv", - "colab_type": "code", - "colab": {} - }, - "cell_type": "code", - "source": [ - "" - ], - "execution_count": 0, - "outputs": [] + "ename": "ValueError", + "evalue": "invalid literal for int() with base 10: 'a'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mfindsum\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"a\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\"3\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m\u001b[0m in \u001b[0;36mfindsum\u001b[0;34m(a, b)\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mfindsum\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ma\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mb\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ma\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mb\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mValueError\u001b[0m: invalid literal for int() with base 10: 'a'" + ] } - ] -} \ No newline at end of file + ], + "source": [ + "1*1=1\n", + "1*2=2\n", + "1*3=3\n", + ".\n", + ".\n", + ".\n", + ".\n", + "1*12=12\n", + "\n", + "multiply(1)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "colab": { + "include_colab_link": true, + "name": "Python Workshop Level 1", + "provenance": [], + "version": "0.3.2" + }, + "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.6.5" + } + }, + "nbformat": 4, + "nbformat_minor": 1 +} From ca706026183c008c8dd53ada85dc1b8f7717fe2d Mon Sep 17 00:00:00 2001 From: Pranoy Dev Date: Tue, 2 Oct 2018 21:01:59 +0530 Subject: [PATCH 2/2] Multiplication code added in day 1 notes --- .../Python_Workshop_Level_1-checkpoint.ipynb | 593 ++++++++++++++++++ Python_Workshop_Level_1.ipynb | 39 +- 2 files changed, 607 insertions(+), 25 deletions(-) create mode 100644 .ipynb_checkpoints/Python_Workshop_Level_1-checkpoint.ipynb diff --git a/.ipynb_checkpoints/Python_Workshop_Level_1-checkpoint.ipynb b/.ipynb_checkpoints/Python_Workshop_Level_1-checkpoint.ipynb new file mode 100644 index 0000000..428b34f --- /dev/null +++ b/.ipynb_checkpoints/Python_Workshop_Level_1-checkpoint.ipynb @@ -0,0 +1,593 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "view-in-github" + }, + "source": [ + "[View in Colaboratory](https://colab.research.google.com/github/martin-raven/Python_Level_1/blob/master/Python_Workshop_Level_1.ipynb)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "kRUpZl5kabzI" + }, + "source": [ + "![alt text](https://u.imageresize.org/v2/61003344-d43f-44b9-8703-067f07b6a5ba.jpeg)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "ZcLm9AIAHZp3" + }, + "source": [ + "\n", + "\n", + "\n", + "![](https://s3.ap-south-1.amazonaws.com/workshoppython1/LOGO+IODev+ev+center+HQ.png)\n", + "# **Welcome to the Workshop By IODev on Python**\n", + "\n", + "![alt text](https://media1.tenor.com/images/0465c304389c5c779c2957fd65d01817/tenor.gif?itemid=12083183)\n", + "\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "SzqEG2-EMIqZ" + }, + "source": [ + "---\n", + "\n", + "\n", + "\n", + "---\n", + "**Who are we**\n", + "\n", + "\n", + "---\n", + "\n", + "\n", + "\n", + "![alt text](https://i.imgur.com/4MkSCjC.jpg)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "yzOr-kdIf0AA" + }, + "source": [ + "---\n", + "\n", + "\n", + "\n", + "---\n", + "## Why is python easier?\n", + "---\n", + "![alt text](https://qph.fs.quoracdn.net/main-qimg-4b668ad2c9f0185fc11c6eddeb0590cc-c)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "Sa6PeXY6k9y4" + }, + "source": [ + "---\n", + "\n", + "\n", + "\n", + "---\n", + "# **What is not programming**\n", + "---\n", + "![alt text](https://media0.giphy.com/media/ZVik7pBtu9dNS/200.gif?cid=3640f6095bb253e44962756e771e3c14)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "HMtCPMHc2bue" + }, + "source": [ + "---\n", + "\n", + "\n", + "\n", + "---\n", + "**Does learning python pay off**\n", + "---\n", + "\n", + "![alt text](http://www.codingdojo.com/blog/wp-content/uploads/2018-developer-job-listings-for-most-popular-programming-languages1.jpg)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "rHRymecL26gv" + }, + "source": [ + "---\n", + "\n", + "\n", + "\n", + "---\n", + "**Who uses python?**\n", + "\n", + "\n", + "---\n", + "\n", + "\n", + "\n", + "![alt text](https://www.probytes.net/wp-content/uploads/2018/08/appl.png)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "DVAu45zXIXwO" + }, + "source": [ + "![alt text](https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRhwVPVA4JdA45AcCm8HXsLnoPWRW7xICDK90ug7jZ9ToWWMApi)\n", + "\n", + "\n", + "**Appo Thudagam?**" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "colab": {}, + "colab_type": "code", + "id": "qudp9h-b_lPw" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "66\n" + ] + } + ], + "source": [ + "# First Program\n", + "name=\"something\"\n", + "# type(7.0)\n", + "# print(1+1)\n", + "a=\"22\"\n", + "b=\"44\"\n", + "print(int(a)+int(b))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "N2Q0FI12Ig4z" + }, + "source": [ + "Datatype enna sambhavam?\n", + "\n", + "\n", + "![alt text](http://i.ebayimg.com/00/s/NDgwWDQ4MA==/z/~H0AAOxyUrZS-txs/$_3.JPG?set_id=2)\n", + "\n", + "![alt text](https://images-na.ssl-images-amazon.com/images/I/41qNFgJqvVL._SY355_.jpg)" + ] + }, + { + "cell_type": "code", + "execution_count": 0, + "metadata": { + "colab": {}, + "colab_type": "code", + "id": "756cGMUS_9d1" + }, + "outputs": [], + "source": [ + "# DataTypes" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "colab": {}, + "colab_type": "code", + "id": "XfRCU_zrAEAk" + }, + "outputs": [ + { + "data": { + "text/plain": [ + "bool" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Variables\n", + "# int,float,str,boolean\n", + "type(True)" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "colab": {}, + "colab_type": "code", + "id": "6o8VWOsCAdyT" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 2, 2, 4]\n", + "(1, 2, 2, 4)\n" + ] + } + ], + "source": [ + "# List\n", + "# help(list)\n", + "test_list=[1,2,2,4]\n", + "print(test_list)\n", + "test_tuple=(1,2,2,4)\n", + "print(test_tuple)" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": { + "colab": {}, + "colab_type": "code", + "id": "8PhFKQ8mBWoH" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{1, 2}\n" + ] + } + ], + "source": [ + "# Set\n", + "test_set={1,2,2,2}\n", + "print(test_set)\n", + "\n", + "\n", + "\n", + "test_list=[1,2,2,4,4,4]\n", + "print(set(test_list))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": { + "colab": {}, + "colab_type": "code", + "id": "6dQJ0sEpBXu_" + }, + "outputs": [ + { + "data": { + "text/plain": [ + "dict" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Dict\n", + "type({\"dog\":[1,2,2],\"cat\":\"Another animal\"})" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "yHy7eU6cGGBh" + }, + "source": [ + "# Comments\n", + "\n", + "Comments are lines of code/text that is ignored by the interperter" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 53 + }, + "colab_type": "code", + "id": "IBADgahzGbJY", + "outputId": "a30a3cbc-1b5a-4e93-9c98-76dfa577440b" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Neee Po mwone dineshaa\n", + "31\n" + ] + } + ], + "source": [ + "#Ikka Mass Aaanu Mwone\n", + "print(\"Neee Po mwone dineshaa\")\n", + "\n", + "print(15*2+1)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "0Kaxg04GGjwR" + }, + "source": [ + "is a single line comment\n" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "colab_type": "code", + "id": "A099cXtxGpMj", + "outputId": "407cbd13-b685-4042-8020-bf8c2b57c8a6" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter the Age 101\n", + "Submit Medical Fitness Certificate\n" + ] + } + ], + "source": [ + "age = int(input(\"Enter the Age \"))\n", + "if age>=18 and age<90:\n", + " print(\"You are Elligible\")\n", + "elif age>=90:\n", + " print(\"Submit Medical Fitness Certificate\")\n", + "else:\n", + " print(\"Not Elligible\")" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "1qBCHeI0HJXu" + }, + "source": [ + "is a multiline comment" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "SZFQ6z1_O5Ul" + }, + "source": [ + "# Basic Operators Enthokke?\n", + "\n", + "\n", + "---\n", + "\n", + "# [Operators](https://www.geeksforgeeks.org/basic-operators-python/)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "pSRw3e2DWjXX" + }, + "source": [ + "# Operator Precedence Entha?\n", + "\n", + "---\n", + "# [Operator Precedence chart](http://www.tutorialspoint.com/python/operators_precedence_example.htm)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "_LZwmrJ7OOUV" + }, + "source": [ + "\n", + "\n", + "---\n", + "\n", + "\n", + "\n", + "---\n", + "\n", + "\n", + "# Now we loop.\n", + "\n", + "\n", + "---\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "![alt text](https://media.giphy.com/media/fCU0PktW618D2VuXki/giphy.gif)\n", + "\n", + "## **3 Types of loops**\n", + "\n", + "* **While**\n", + "![alt text](http://www.mathwarehouse.com/programming/images/while_loop/top-5-programming-animated-gifs_demonstration-of-while-loop-animation_logo.gif)\n", + "* **Do while**\n", + "* **For**\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 0, + "metadata": { + "colab": {}, + "colab_type": "code", + "id": "3bLBnZxlSveg" + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "k4MwgNC-TqCc" + }, + "source": [ + "---\n", + "\n", + "\n", + "\n", + "---\n", + "\n", + "# **Functions**\n", + "\n", + "---\n", + "![alt text](https://media1.tenor.com/images/aed8a9012f98c1f3b7a6e678c15ac829/tenor.gif?itemid=12071848)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": { + "colab": {}, + "colab_type": "code", + "id": "GnGu1GmubZqv" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "enter a : 5\n", + "enter b : 7\n" + ] + }, + { + "data": { + "text/plain": [ + "12" + ] + }, + "execution_count": 65, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "def findsum(a,b):\n", + " if a.isdigit() and b.isdigit():\n", + " return int(a)+int(b)\n", + " else:\n", + " return \"either one or more are strings\"\n", + "findsum(input(\"enter a : \"), input(\"enter b : \"))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def multiply(num):\n", + " for i in range(12):\n", + " print(num,\" * \",i,\" = \",num*i)\n", + "n=int(input(\"Enter Number\"))\n", + "multiply(n)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "colab": { + "include_colab_link": true, + "name": "Python Workshop Level 1", + "provenance": [], + "version": "0.3.2" + }, + "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.6.5" + } + }, + "nbformat": 4, + "nbformat_minor": 1 +} diff --git a/Python_Workshop_Level_1.ipynb b/Python_Workshop_Level_1.ipynb index db6b923..428b34f 100644 --- a/Python_Workshop_Level_1.ipynb +++ b/Python_Workshop_Level_1.ipynb @@ -537,35 +537,24 @@ }, { "cell_type": "code", - "execution_count": 56, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "ename": "ValueError", - "evalue": "invalid literal for int() with base 10: 'a'", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mfindsum\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"a\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\"3\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m\u001b[0m in \u001b[0;36mfindsum\u001b[0;34m(a, b)\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mfindsum\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ma\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mb\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ma\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mb\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;31mValueError\u001b[0m: invalid literal for int() with base 10: 'a'" - ] - } - ], + "outputs": [], "source": [ - "1*1=1\n", - "1*2=2\n", - "1*3=3\n", - ".\n", - ".\n", - ".\n", - ".\n", - "1*12=12\n", - "\n", - "multiply(1)" + "def multiply(num):\n", + " for i in range(12):\n", + " print(num,\" * \",i,\" = \",num*i)\n", + "n=int(input(\"Enter Number\"))\n", + "multiply(n)" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "code", "execution_count": null,