{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "Week1_Assignment.ipynb",
      "provenance": [],
      "collapsed_sections": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "cDSWoNO0XM3g"
      },
      "source": [
        "Practice Assignment for week 08/31"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "QtjyBkh7X8ZI"
      },
      "source": [
        "Question 1 : \"Palindrome\" script -- take any string, and find out if it is a palindrome"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "THWe1k_rXWn4"
      },
      "source": [
        "import pandas "
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "QQMPx2cCcrMU",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 35
        },
        "outputId": "2691ff3b-003a-44ba-a118-8c1f58f9ceca"
      },
      "source": [
        "x = 'test'\n",
        "\n",
        "y = ''\n",
        "for i in x:\n",
        "  y = i + y\n",
        "print(y)"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "tset\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "CBi2c46edIxB",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        },
        "outputId": "8cd4c715-2a9e-4d0c-ba48-639ad4532e2b"
      },
      "source": [
        "if (x == y):\n",
        "  print(\"Yes, it is a palindrome\")\n",
        "else:\n",
        "  print(\"No, it is not a palindrome\")"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Yes, it is a palindrome\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "XA6f35nZkuEn"
      },
      "source": [
        "Question 2: Create a huge dataset of fake data (or real data) using a list of dicts as a data structure. Iterate through that list; if a record matches some condition, print it"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "AbSRbSq5lL3D"
      },
      "source": [
        "Example 1:"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "n3aHGziDdaV7"
      },
      "source": [
        "import random\n",
        "import string"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "JXP1Cmf1lmpc",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        },
        "outputId": "651a1f27-2d52-42de-8382-f78a5da65012"
      },
      "source": [
        "word = string.ascii_lowercase\n",
        "final_word = ''.join(random.choice(word) for i in range(3))\n",
        "print(final_word)"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "elh\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "qoFDSeC5lnSm",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        },
        "outputId": "dd49b6b4-054a-45c2-bc34-75769da3162b"
      },
      "source": [
        "my_dict = {\"A\"+str(i):final_word for i in range(100,999)}\n",
        "#my_dict\n",
        "\n",
        "for i in list(my_dict.keys()):\n",
        "  if i == \"A100\":\n",
        "    print(i, my_dict[i])"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "A100 elh\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "TsFznR62mPz-"
      },
      "source": [
        "Example 2:"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "ahSGbFrTmIqg",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 54
        },
        "outputId": "6eada4e9-56b2-4e66-ee74-725f820f12b4"
      },
      "source": [
        "new_dict = {}\n",
        "for i in range(200):\n",
        "  new_dict['EMSE'+str(i)] = random.randrange(200)\n",
        "print(new_dict)"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "{'EMSE0': 0, 'EMSE1': 13, 'EMSE2': 12, 'EMSE3': 14, 'EMSE4': 8, 'EMSE5': 14, 'EMSE6': 5, 'EMSE7': 5, 'EMSE8': 16, 'EMSE9': 13, 'EMSE10': 11, 'EMSE11': 7, 'EMSE12': 18, 'EMSE13': 13, 'EMSE14': 6, 'EMSE15': 19, 'EMSE16': 2, 'EMSE17': 18, 'EMSE18': 1, 'EMSE19': 18, 'EMSE20': 16, 'EMSE21': 4, 'EMSE22': 14, 'EMSE23': 17, 'EMSE24': 0, 'EMSE25': 1, 'EMSE26': 16, 'EMSE27': 16, 'EMSE28': 2, 'EMSE29': 3, 'EMSE30': 8, 'EMSE31': 2, 'EMSE32': 12, 'EMSE33': 6, 'EMSE34': 8, 'EMSE35': 1, 'EMSE36': 15, 'EMSE37': 7, 'EMSE38': 11, 'EMSE39': 11, 'EMSE40': 15, 'EMSE41': 4, 'EMSE42': 7, 'EMSE43': 0, 'EMSE44': 7, 'EMSE45': 15, 'EMSE46': 10, 'EMSE47': 16, 'EMSE48': 3, 'EMSE49': 18, 'EMSE50': 12, 'EMSE51': 19, 'EMSE52': 17, 'EMSE53': 10, 'EMSE54': 1, 'EMSE55': 9, 'EMSE56': 1, 'EMSE57': 0, 'EMSE58': 11, 'EMSE59': 5, 'EMSE60': 9, 'EMSE61': 3, 'EMSE62': 8, 'EMSE63': 3, 'EMSE64': 14, 'EMSE65': 8, 'EMSE66': 3, 'EMSE67': 0, 'EMSE68': 16, 'EMSE69': 2, 'EMSE70': 12, 'EMSE71': 0, 'EMSE72': 5, 'EMSE73': 13, 'EMSE74': 11, 'EMSE75': 8, 'EMSE76': 5, 'EMSE77': 19, 'EMSE78': 14, 'EMSE79': 4, 'EMSE80': 17, 'EMSE81': 6, 'EMSE82': 13, 'EMSE83': 10, 'EMSE84': 17, 'EMSE85': 1, 'EMSE86': 3, 'EMSE87': 1, 'EMSE88': 2, 'EMSE89': 1, 'EMSE90': 12, 'EMSE91': 16, 'EMSE92': 0, 'EMSE93': 0, 'EMSE94': 12, 'EMSE95': 2, 'EMSE96': 0, 'EMSE97': 1, 'EMSE98': 6, 'EMSE99': 9, 'EMSE100': 11, 'EMSE101': 18, 'EMSE102': 5, 'EMSE103': 16, 'EMSE104': 3, 'EMSE105': 2, 'EMSE106': 0, 'EMSE107': 12, 'EMSE108': 11, 'EMSE109': 8, 'EMSE110': 8, 'EMSE111': 10, 'EMSE112': 19, 'EMSE113': 8, 'EMSE114': 2, 'EMSE115': 18, 'EMSE116': 3, 'EMSE117': 11, 'EMSE118': 4, 'EMSE119': 3, 'EMSE120': 4, 'EMSE121': 2, 'EMSE122': 6, 'EMSE123': 6, 'EMSE124': 1, 'EMSE125': 15, 'EMSE126': 10, 'EMSE127': 6, 'EMSE128': 9, 'EMSE129': 5, 'EMSE130': 2, 'EMSE131': 2, 'EMSE132': 3, 'EMSE133': 15, 'EMSE134': 19, 'EMSE135': 18, 'EMSE136': 13, 'EMSE137': 17, 'EMSE138': 18, 'EMSE139': 17, 'EMSE140': 9, 'EMSE141': 17, 'EMSE142': 17, 'EMSE143': 16, 'EMSE144': 16, 'EMSE145': 1, 'EMSE146': 4, 'EMSE147': 10, 'EMSE148': 19, 'EMSE149': 7, 'EMSE150': 18, 'EMSE151': 14, 'EMSE152': 11, 'EMSE153': 12, 'EMSE154': 18, 'EMSE155': 10, 'EMSE156': 8, 'EMSE157': 12, 'EMSE158': 15, 'EMSE159': 8, 'EMSE160': 4, 'EMSE161': 13, 'EMSE162': 5, 'EMSE163': 15, 'EMSE164': 7, 'EMSE165': 2, 'EMSE166': 18, 'EMSE167': 11, 'EMSE168': 6, 'EMSE169': 3, 'EMSE170': 16, 'EMSE171': 6, 'EMSE172': 10, 'EMSE173': 0, 'EMSE174': 18, 'EMSE175': 9, 'EMSE176': 9, 'EMSE177': 0, 'EMSE178': 18, 'EMSE179': 11, 'EMSE180': 19, 'EMSE181': 18, 'EMSE182': 4, 'EMSE183': 14, 'EMSE184': 6, 'EMSE185': 0, 'EMSE186': 1, 'EMSE187': 12, 'EMSE188': 0, 'EMSE189': 4, 'EMSE190': 0, 'EMSE191': 16, 'EMSE192': 14, 'EMSE193': 3, 'EMSE194': 7, 'EMSE195': 5, 'EMSE196': 19, 'EMSE197': 17, 'EMSE198': 9, 'EMSE199': 5}\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "zfCu0LVNmanw",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 816
        },
        "outputId": "7562e8d4-520b-48d3-adff-60ac84696273"
      },
      "source": [
        "for key, value in new_dict.items():\n",
        "  if value >= 4 and value < 9:\n",
        "    print(key, value)"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "EMSE4 8\n",
            "EMSE6 5\n",
            "EMSE7 5\n",
            "EMSE11 7\n",
            "EMSE14 6\n",
            "EMSE21 4\n",
            "EMSE30 8\n",
            "EMSE33 6\n",
            "EMSE34 8\n",
            "EMSE37 7\n",
            "EMSE41 4\n",
            "EMSE42 7\n",
            "EMSE44 7\n",
            "EMSE59 5\n",
            "EMSE62 8\n",
            "EMSE65 8\n",
            "EMSE72 5\n",
            "EMSE75 8\n",
            "EMSE76 5\n",
            "EMSE79 4\n",
            "EMSE81 6\n",
            "EMSE98 6\n",
            "EMSE102 5\n",
            "EMSE109 8\n",
            "EMSE110 8\n",
            "EMSE113 8\n",
            "EMSE118 4\n",
            "EMSE120 4\n",
            "EMSE122 6\n",
            "EMSE123 6\n",
            "EMSE127 6\n",
            "EMSE129 5\n",
            "EMSE146 4\n",
            "EMSE149 7\n",
            "EMSE156 8\n",
            "EMSE159 8\n",
            "EMSE160 4\n",
            "EMSE162 5\n",
            "EMSE164 7\n",
            "EMSE168 6\n",
            "EMSE171 6\n",
            "EMSE182 4\n",
            "EMSE184 6\n",
            "EMSE189 4\n",
            "EMSE194 7\n",
            "EMSE195 5\n",
            "EMSE199 5\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "o5ittiHCmcUC"
      },
      "source": [
        ""
      ],
      "execution_count": null,
      "outputs": []
    }
  ]
}