From 46e628cf188e9c4ec8f77f64af1e6bc61a18830f Mon Sep 17 00:00:00 2001 From: Sahil Kalyani Date: Sat, 29 Sep 2018 00:43:22 +0530 Subject: [PATCH] Problem Solved! --- sahil-75.ipynb | 289 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 259 insertions(+), 30 deletions(-) diff --git a/sahil-75.ipynb b/sahil-75.ipynb index 9e2543a..33c154c 100644 --- a/sahil-75.ipynb +++ b/sahil-75.ipynb @@ -1,32 +1,261 @@ { - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "sahil-75.ipynb", + "version": "0.3.2", + "provenance": [] + }, + "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.5.2" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} + "cells": [ + { + "metadata": { + "id": "yAAAMaSbdha2", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "dummy_list = [5,7,25,75]" + ], + "execution_count": 0, + "outputs": [] + }, + { + "metadata": { + "id": "GENjA6ejd3-C", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "outputId": "adbf2d81-3366-4613-c9ec-be2bb948c642" + }, + "cell_type": "code", + "source": [ + "print(dummy_list)" + ], + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "text": [ + "[5, 7, 25, 75]\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "BgB2JEEEeRQ6", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "outputId": "c7061d21-38c3-4234-cb0b-d603e44a061a" + }, + "cell_type": "code", + "source": [ + "print(dummy_list[::-1])" + ], + "execution_count": 3, + "outputs": [ + { + "output_type": "stream", + "text": [ + "[75, 25, 7, 5]\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "LXOW8KyBeaEc", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "outputId": "a91112ce-a5c1-44ef-a77d-c7a282074195" + }, + "cell_type": "code", + "source": [ + "dummy_list_2 = [2, 200, 16, 4, 1, 0, 9.45, 45.67, 90, 12.01, 12.02]\n", + "dummy_list.extend(dummy_list_2)\n", + "print(dummy_list)" + ], + "execution_count": 4, + "outputs": [ + { + "output_type": "stream", + "text": [ + "[5, 7, 25, 75, 2, 200, 16, 4, 1, 0, 9.45, 45.67, 90, 12.01, 12.02]\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "uU7npkPfe5Qd", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "dummy_dict = {}\n", + "for i in dummy_list:\n", + " if i in dummy_dict:\n", + " dummy_dict[i] += 1\n", + " else:\n", + " dummy_dict[i] = 1" + ], + "execution_count": 0, + "outputs": [] + }, + { + "metadata": { + "id": "q9JT7on-hR9d", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "outputId": "20b27329-e474-429d-d2fa-2d7446de8377" + }, + "cell_type": "code", + "source": [ + "print(dummy_dict)" + ], + "execution_count": 10, + "outputs": [ + { + "output_type": "stream", + "text": [ + "{5: 1, 7: 1, 25: 1, 75: 1, 2: 1, 200: 1, 16: 1, 4: 1, 1: 1, 0: 1, 9.45: 1, 45.67: 1, 90: 1, 12.01: 1, 12.02: 1}\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "hpNDVCOkiPo3", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 51 + }, + "outputId": "570f0028-36ea-435d-a0e4-e479215df39a" + }, + "cell_type": "code", + "source": [ + "dummy_list.sort()\n", + "print(dummy_list)\n", + "\n", + "dummy_list.sort(reverse=True)\n", + "print(dummy_list)" + ], + "execution_count": 12, + "outputs": [ + { + "output_type": "stream", + "text": [ + "[0, 1, 2, 4, 5, 7, 9.45, 12.01, 12.02, 16, 25, 45.67, 75, 90, 200]\n", + "[200, 90, 75, 45.67, 25, 16, 12.02, 12.01, 9.45, 7, 5, 4, 2, 1, 0]\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "lE-A-l21kNso", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "outputId": "2ca30a1e-a2a6-4c08-a788-e4f7b9c0ff6f" + }, + "cell_type": "code", + "source": [ + "x = 200\n", + "dummy_list.remove(x)\n", + "print(dummy_list)" + ], + "execution_count": 13, + "outputs": [ + { + "output_type": "stream", + "text": [ + "[90, 75, 45.67, 25, 16, 12.02, 12.01, 9.45, 7, 5, 4, 2, 1, 0]\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "MpDYoLJNkRNG", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "outputId": "852502d9-8dba-449a-9e69-ebff6d84b298" + }, + "cell_type": "code", + "source": [ + "x = 8\n", + "del dummy_list[x]\n", + "print(dummy_list)" + ], + "execution_count": 14, + "outputs": [ + { + "output_type": "stream", + "text": [ + "[90, 75, 45.67, 25, 16, 12.02, 12.01, 9.45, 5, 4, 2, 1, 0]\n" + ], + "name": "stdout" + } + ] + }, + { + "metadata": { + "id": "JQggQy6Bk4Q3", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "outputId": "9579fce2-bcbf-4ba5-c619-1a83fb4db992" + }, + "cell_type": "code", + "source": [ + "dummy_list.clear()\n", + "print(dummy_list)" + ], + "execution_count": 15, + "outputs": [ + { + "output_type": "stream", + "text": [ + "[]\n" + ], + "name": "stdout" + } + ] + } + ] +} \ No newline at end of file