From 5036c42139d8521a8790cabc2b8199b236061d0a Mon Sep 17 00:00:00 2001 From: Arghya Date: Thu, 5 Mar 2020 12:26:15 +0530 Subject: [PATCH 1/4] Created using Colaboratory --- Questions/Excercise numpy .ipynb | 243 ++++++++++++++++++++++++++++++- 1 file changed, 242 insertions(+), 1 deletion(-) diff --git a/Questions/Excercise numpy .ipynb b/Questions/Excercise numpy .ipynb index 92ed880..4812261 100644 --- a/Questions/Excercise numpy .ipynb +++ b/Questions/Excercise numpy .ipynb @@ -1 +1,242 @@ -{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"name":"Excercise numpy .ipynb","provenance":[],"authorship_tag":"ABX9TyMEuYnB4Fa7QF811lAB6GtK"},"kernelspec":{"name":"python3","display_name":"Python 3"}},"cells":[{"cell_type":"markdown","metadata":{"id":"a_4UupTr9fbX","colab_type":"text"},"source":["# Numpy Exercises\n","\n","1) Create a uniform subdivision of the interval -1.3 to 2.5 with 64 subdivisions"]},{"cell_type":"code","metadata":{"id":"LIP5u4zi0Nmg","colab_type":"code","colab":{}},"source":["import numpy as np #import numpy"],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"dBoH_A7M9jjL","colab_type":"text"},"source":["2) Generate an array of length 3n filled with the cyclic pattern 1, 2, 3"]},{"cell_type":"code","metadata":{"id":"4TxT66309n1o","colab_type":"code","colab":{}},"source":[""],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"Vh-UKizx9oTp","colab_type":"text"},"source":["3) Create an array of the first 10 odd integers."]},{"cell_type":"code","metadata":{"id":"ebhEUZq29r32","colab_type":"code","colab":{}},"source":[""],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"QfJRdMat90f4","colab_type":"text"},"source":["4) Find intersection of a and b"]},{"cell_type":"code","metadata":{"id":"gOlfuJCo-JwF","colab_type":"code","colab":{}},"source":["#expected output array([2, 4])\n","a = np.array([1,2,3,2,3,4,3,4,5,6])\n","b = np.array([7,2,10,2,7,4,9,4,9,8])"],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"RtVCf0UoCeB8","colab_type":"text"},"source":["5) Reshape 1d array a to 2d array of 2X5"]},{"cell_type":"code","metadata":{"id":"2E8b55_2Cjx5","colab_type":"code","colab":{}},"source":["a = np.arange(10)"],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"dVrSBW1zEjp2","colab_type":"text"},"source":["6) Create a numpy array to list and vice versa"]},{"cell_type":"code","metadata":{"id":"tcBCyhXPEp9C","colab_type":"code","colab":{}},"source":["a = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n"],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"JNqX8wnz9sQJ","colab_type":"text"},"source":["7) Create a 10 x 10 arrays of zeros and then \"frame\" it with a border of ones."]},{"cell_type":"code","metadata":{"id":"4bjP3JAc9vRD","colab_type":"code","colab":{}},"source":[""],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"xaQgf8tT9v-n","colab_type":"text"},"source":["8) Create an 8 x 8 array with a checkerboard pattern of zeros and ones using a slicing+striding approach."]},{"cell_type":"code","metadata":{"id":"No7fx0Xy9zEh","colab_type":"code","colab":{}},"source":[""],"execution_count":0,"outputs":[]}]} \ No newline at end of file +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "Excercise numpy .ipynb", + "provenance": [], + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "a_4UupTr9fbX", + "colab_type": "text" + }, + "source": [ + "# Numpy Exercises\n", + "\n", + "1) Create a uniform subdivision of the interval -1.3 to 2.5 with 64 subdivisions" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "LIP5u4zi0Nmg", + "colab_type": "code", + "colab": {} + }, + "source": [ + "import numpy as np #import numpy" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "dBoH_A7M9jjL", + "colab_type": "text" + }, + "source": [ + "2) Generate an array of length 3n filled with the cyclic pattern 1, 2, 3" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "4TxT66309n1o", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "outputId": "1503e3e9-1d9c-4a23-e4d7-69408b6feb08" + }, + "source": [ + "a= np.arange(1,4)\n", + "print(a)" + ], + "execution_count": 5, + "outputs": [ + { + "output_type": "stream", + "text": [ + "[1 2 3]\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Vh-UKizx9oTp", + "colab_type": "text" + }, + "source": [ + "3) Create an array of the first 10 odd integers." + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "ebhEUZq29r32", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "outputId": "6c9eb962-47b5-417c-d443-acdd77f20e98" + }, + "source": [ + "b=np.arange(1,20)\n", + "bodd=b[b%2!=0]\n", + "print(bodd)" + ], + "execution_count": 10, + "outputs": [ + { + "output_type": "stream", + "text": [ + "[ 1 3 5 7 9 11 13 15 17 19]\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "QfJRdMat90f4", + "colab_type": "text" + }, + "source": [ + "4) Find intersection of a and b" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "gOlfuJCo-JwF", + "colab_type": "code", + "colab": {} + }, + "source": [ + "#expected output array([2, 4])\n", + "a = np.array([1,2,3,2,3,4,3,4,5,6])\n", + "b = np.array([7,2,10,2,7,4,9,4,9,8])" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "RtVCf0UoCeB8", + "colab_type": "text" + }, + "source": [ + "5) Reshape 1d array a to 2d array of 2X5" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "2E8b55_2Cjx5", + "colab_type": "code", + "colab": {} + }, + "source": [ + "a = np.arange(10)" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "dVrSBW1zEjp2", + "colab_type": "text" + }, + "source": [ + "6) Create a numpy array to list and vice versa" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "tcBCyhXPEp9C", + "colab_type": "code", + "colab": {} + }, + "source": [ + "a = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "JNqX8wnz9sQJ", + "colab_type": "text" + }, + "source": [ + "7) Create a 10 x 10 arrays of zeros and then \"frame\" it with a border of ones." + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "4bjP3JAc9vRD", + "colab_type": "code", + "colab": {} + }, + "source": [ + "" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "xaQgf8tT9v-n", + "colab_type": "text" + }, + "source": [ + "8) Create an 8 x 8 array with a checkerboard pattern of zeros and ones using a slicing+striding approach." + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "No7fx0Xy9zEh", + "colab_type": "code", + "colab": {} + }, + "source": [ + "" + ], + "execution_count": 0, + "outputs": [] + } + ] +} \ No newline at end of file From f53cb62e137bf62b42bf68fd39110774751c3774 Mon Sep 17 00:00:00 2001 From: Arghya Date: Thu, 5 Mar 2020 19:51:22 +0530 Subject: [PATCH 2/4] completed this assignment --- Questions/Excercise numpy .ipynb | 85 +++++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 19 deletions(-) diff --git a/Questions/Excercise numpy .ipynb b/Questions/Excercise numpy .ipynb index 4812261..b203fd4 100644 --- a/Questions/Excercise numpy .ipynb +++ b/Questions/Excercise numpy .ipynb @@ -63,17 +63,17 @@ "metadata": { "id": "4TxT66309n1o", "colab_type": "code", + "outputId": "1503e3e9-1d9c-4a23-e4d7-69408b6feb08", "colab": { "base_uri": "https://localhost:8080/", "height": 34 - }, - "outputId": "1503e3e9-1d9c-4a23-e4d7-69408b6feb08" + } }, "source": [ "a= np.arange(1,4)\n", "print(a)" ], - "execution_count": 5, + "execution_count": 0, "outputs": [ { "output_type": "stream", @@ -99,18 +99,18 @@ "metadata": { "id": "ebhEUZq29r32", "colab_type": "code", + "outputId": "6c9eb962-47b5-417c-d443-acdd77f20e98", "colab": { "base_uri": "https://localhost:8080/", "height": 34 - }, - "outputId": "6c9eb962-47b5-417c-d443-acdd77f20e98" + } }, "source": [ "b=np.arange(1,20)\n", "bodd=b[b%2!=0]\n", "print(bodd)" ], - "execution_count": 10, + "execution_count": 0, "outputs": [ { "output_type": "stream", @@ -136,15 +136,30 @@ "metadata": { "id": "gOlfuJCo-JwF", "colab_type": "code", - "colab": {} + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "outputId": "f886865b-b263-457e-8b1d-d8d7a076b92f" }, "source": [ "#expected output array([2, 4])\n", "a = np.array([1,2,3,2,3,4,3,4,5,6])\n", - "b = np.array([7,2,10,2,7,4,9,4,9,8])" + "b = np.array([7,2,10,2,7,4,9,4,9,8])\n", + "common=set(a) & set(b)\n", + "print(common)\n", + "\n" ], - "execution_count": 0, - "outputs": [] + "execution_count": 6, + "outputs": [ + { + "output_type": "stream", + "text": [ + "{2, 4}\n" + ], + "name": "stdout" + } + ] }, { "cell_type": "markdown", @@ -161,13 +176,28 @@ "metadata": { "id": "2E8b55_2Cjx5", "colab_type": "code", - "colab": {} + "colab": { + "base_uri": "https://localhost:8080/", + "height": 52 + }, + "outputId": "efaac056-f8da-4838-cd93-52385c34f87d" }, "source": [ - "a = np.arange(10)" + "a = np.arange(10)\n", + "b=a.reshape(2,5)\n", + "print(b)" ], - "execution_count": 0, - "outputs": [] + "execution_count": 8, + "outputs": [ + { + "output_type": "stream", + "text": [ + "[[0 1 2 3 4]\n", + " [5 6 7 8 9]]\n" + ], + "name": "stdout" + } + ] }, { "cell_type": "markdown", @@ -184,13 +214,30 @@ "metadata": { "id": "tcBCyhXPEp9C", "colab_type": "code", - "colab": {} + "colab": { + "base_uri": "https://localhost:8080/", + "height": 52 + }, + "outputId": "46afaf08-42cb-448e-d3a7-3b8705068d55" }, "source": [ - "a = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n" + "a = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n", + "b=np.array(a) #creating a array\n", + "print(b)\n", + "a=list(a) #creating a list\n", + "print(a)" ], - "execution_count": 0, - "outputs": [] + "execution_count": 10, + "outputs": [ + { + "output_type": "stream", + "text": [ + "[1 2 3 4 5 6 7 8 9]\n", + "[1, 2, 3, 4, 5, 6, 7, 8, 9]\n" + ], + "name": "stdout" + } + ] }, { "cell_type": "markdown", @@ -210,7 +257,7 @@ "colab": {} }, "source": [ - "" + "\n" ], "execution_count": 0, "outputs": [] From 20f7021555cca4155ba5fd083a1ac68b046666e2 Mon Sep 17 00:00:00 2001 From: Arghya Date: Thu, 5 Mar 2020 20:02:26 +0530 Subject: [PATCH 3/4] Created using Colaboratory --- Questions/Excercise numpy .ipynb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Questions/Excercise numpy .ipynb b/Questions/Excercise numpy .ipynb index b203fd4..9bae597 100644 --- a/Questions/Excercise numpy .ipynb +++ b/Questions/Excercise numpy .ipynb @@ -63,17 +63,17 @@ "metadata": { "id": "4TxT66309n1o", "colab_type": "code", - "outputId": "1503e3e9-1d9c-4a23-e4d7-69408b6feb08", + "outputId": "d8400a1a-71a6-45f3-b3bb-01cc127c2a71", "colab": { "base_uri": "https://localhost:8080/", "height": 34 } }, "source": [ - "a= np.arange(1,4)\n", + "a= np.array([1,2,3])\n", "print(a)" ], - "execution_count": 0, + "execution_count": 12, "outputs": [ { "output_type": "stream", @@ -99,18 +99,17 @@ "metadata": { "id": "ebhEUZq29r32", "colab_type": "code", - "outputId": "6c9eb962-47b5-417c-d443-acdd77f20e98", + "outputId": "8680bc2b-edd5-4d21-dc13-23f4f98b21d6", "colab": { "base_uri": "https://localhost:8080/", "height": 34 } }, "source": [ - "b=np.arange(1,20)\n", - "bodd=b[b%2!=0]\n", - "print(bodd)" + "b=np.arange(1,20,2)\n", + "print(b)" ], - "execution_count": 0, + "execution_count": 13, "outputs": [ { "output_type": "stream", From 62ef9543c6b817c5c810e5ad66d6ae4fff638b59 Mon Sep 17 00:00:00 2001 From: Arghya Date: Thu, 5 Mar 2020 20:29:16 +0530 Subject: [PATCH 4/4] semi-completed --- Questions/List 1.ipynb | 325 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 324 insertions(+), 1 deletion(-) diff --git a/Questions/List 1.ipynb b/Questions/List 1.ipynb index 144d52a..0421b49 100644 --- a/Questions/List 1.ipynb +++ b/Questions/List 1.ipynb @@ -1 +1,324 @@ -{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"name":"List 1.ipynb","provenance":[],"authorship_tag":"ABX9TyNLahDgX6PyIABRXbqfMC/+"},"kernelspec":{"name":"python3","display_name":"Python 3"}},"cells":[{"cell_type":"markdown","metadata":{"id":"e0R1W0Vzm4UU","colab_type":"text"},"source":["# Exercise - List"]},{"cell_type":"markdown","metadata":{"id":"TrO7XNQnnQZ7","colab_type":"text"},"source":["1) Create any random list and assign it to a variable dummy_list"]},{"cell_type":"code","metadata":{"id":"bjl-2QkznWid","colab_type":"code","colab":{}},"source":[""],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"cDjddNGfngnp","colab_type":"text"},"source":["2) print dummy_list"]},{"cell_type":"code","metadata":{"id":"RVL5178inz9M","colab_type":"code","colab":{}},"source":[""],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"15jKDXxkn16M","colab_type":"text"},"source":["3) Reverse dummy_list and print"]},{"cell_type":"code","metadata":{"id":"bYa9gFOOn-4o","colab_type":"code","colab":{}},"source":[""],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"EShv0nfXpUys","colab_type":"text"},"source":["4) Add the list dummy_list_2 to the previous dummy_list and now print dummy_list"]},{"cell_type":"code","metadata":{"id":"Ngkc7hnYphg6","colab_type":"code","colab":{}},"source":["dummy_list_2 = [2, 200, 16, 4, 1, 0, 9.45, 45.67, 90, 12.01, 12.02]"],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"Le1aRTuYoDzS","colab_type":"text"},"source":["5) Create a dictionary named dummy_dict which contains all the elements of dummy_list as keys and frequency as values. "]},{"cell_type":"code","metadata":{"id":"VHfSR_Csthnk","colab_type":"code","colab":{}},"source":[""],"execution_count":0,"outputs":[]},{"cell_type":"code","metadata":{"id":"rtPC6WkSos-y","colab_type":"code","colab":{}},"source":[""],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"RgCYpFXGou6q","colab_type":"text"},"source":["6) print dummy_dict"]},{"cell_type":"code","metadata":{"id":"qe5E5IgxpTWU","colab_type":"code","colab":{}},"source":[""],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"8n_nsBDup4--","colab_type":"text"},"source":["7) Sort dummy_list in ascending order as well as descending order and print the changed lists "]},{"cell_type":"code","metadata":{"id":"Z_m7vr26qKnK","colab_type":"code","colab":{}},"source":[""],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"Znm5Qo4LqPKA","colab_type":"text"},"source":["8) Remove the first item from the list whose value is equal to x. It raises a ValueError if there is no such item."]},{"cell_type":"code","metadata":{"id":"1-8mlngDqYvS","colab_type":"code","colab":{}},"source":["x = 200\n","\n","# Let's play: try the same with something which is not in the list to get the ValueError"],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"QPB6iGbeqviN","colab_type":"text"},"source":["9) Remove the item at position x. x is any random integer"]},{"cell_type":"code","metadata":{"id":"aMyo1gmRrVHo","colab_type":"code","colab":{}},"source":["# Let's play: try doing the same with x > len(dummy_list) + 1 and see what you get"],"execution_count":0,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"bqQnnsr8rm6G","colab_type":"text"},"source":["10) Let's clean everything clear the list and then print"]},{"cell_type":"code","metadata":{"id":"qBC8lKpLrtJW","colab_type":"code","colab":{}},"source":[""],"execution_count":0,"outputs":[]}]} \ No newline at end of file +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "List 1.ipynb", + "provenance": [] + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "e0R1W0Vzm4UU", + "colab_type": "text" + }, + "source": [ + "# Exercise - List" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "TrO7XNQnnQZ7", + "colab_type": "text" + }, + "source": [ + "1) Create any random list and assign it to a variable dummy_list" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "bjl-2QkznWid", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "outputId": "79083249-5fb2-4821-d6b5-eaaecf1d2f8b" + }, + "source": [ + "a=list([1,2,3,4,5,6,7,8,9])\n", + "print(a)\n", + "dummy_list=a" + ], + "execution_count": 4, + "outputs": [ + { + "output_type": "stream", + "text": [ + "[1, 2, 3, 4, 5, 6, 7, 8, 9]\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "cDjddNGfngnp", + "colab_type": "text" + }, + "source": [ + "2) print dummy_list" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "RVL5178inz9M", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "outputId": "985fb36d-ab70-48cc-a835-e9cf0836cb5c" + }, + "source": [ + "print(dummy_list)" + ], + "execution_count": 5, + "outputs": [ + { + "output_type": "stream", + "text": [ + "[1, 2, 3, 4, 5, 6, 7, 8, 9]\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "15jKDXxkn16M", + "colab_type": "text" + }, + "source": [ + "3) Reverse dummy_list and print" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "bYa9gFOOn-4o", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "outputId": "1137d728-f5aa-42a0-b0d4-1ac928029172" + }, + "source": [ + "rev= dummy_list[::-1]\n", + "print(rev)" + ], + "execution_count": 11, + "outputs": [ + { + "output_type": "stream", + "text": [ + "[9, 8, 7, 6, 5, 4, 3, 2, 1]\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "EShv0nfXpUys", + "colab_type": "text" + }, + "source": [ + "4) Add the list dummy_list_2 to the previous dummy_list and now print dummy_list" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "Ngkc7hnYphg6", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + }, + "outputId": "995f9663-6f5c-48b1-b1f4-8ec54800f8dc" + }, + "source": [ + "dummy_list_2 = [2, 200, 16, 4, 1, 0, 9.45, 45.67, 90, 12.01, 12.02]\n", + "merge= rev + dummy_list_2\n", + "print(merge)" + ], + "execution_count": 14, + "outputs": [ + { + "output_type": "stream", + "text": [ + "[9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 200, 16, 4, 1, 0, 9.45, 45.67, 90, 12.01, 12.02]\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Le1aRTuYoDzS", + "colab_type": "text" + }, + "source": [ + "5) Create a dictionary named dummy_dict which contains all the elements of dummy_list as keys and frequency as values. " + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "VHfSR_Csthnk", + "colab_type": "code", + "colab": {} + }, + "source": [ + "" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "rtPC6WkSos-y", + "colab_type": "code", + "colab": {} + }, + "source": [ + "" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "RgCYpFXGou6q", + "colab_type": "text" + }, + "source": [ + "6) print dummy_dict" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "qe5E5IgxpTWU", + "colab_type": "code", + "colab": {} + }, + "source": [ + "" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "8n_nsBDup4--", + "colab_type": "text" + }, + "source": [ + "7) Sort dummy_list in ascending order as well as descending order and print the changed lists " + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "Z_m7vr26qKnK", + "colab_type": "code", + "colab": {} + }, + "source": [ + "" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Znm5Qo4LqPKA", + "colab_type": "text" + }, + "source": [ + "8) Remove the first item from the list whose value is equal to x. It raises a ValueError if there is no such item." + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "1-8mlngDqYvS", + "colab_type": "code", + "colab": {} + }, + "source": [ + "x = 200\n", + "\n", + "# Let's play: try the same with something which is not in the list to get the ValueError" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "QPB6iGbeqviN", + "colab_type": "text" + }, + "source": [ + "9) Remove the item at position x. x is any random integer" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "aMyo1gmRrVHo", + "colab_type": "code", + "colab": {} + }, + "source": [ + "# Let's play: try doing the same with x > len(dummy_list) + 1 and see what you get" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "bqQnnsr8rm6G", + "colab_type": "text" + }, + "source": [ + "10) Let's clean everything clear the list and then print" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "qBC8lKpLrtJW", + "colab_type": "code", + "colab": {} + }, + "source": [ + "" + ], + "execution_count": 0, + "outputs": [] + } + ] +} \ No newline at end of file