From a207aeae7e912a369c24dd7c6301bb31299651a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20P=C3=A9rez=20Ortega?= Date: Mon, 5 Jul 2021 00:13:53 -0500 Subject: [PATCH 1/2] Lab terminado --- .DS_Store | Bin 0 -> 6148 bytes .../.ipynb_checkpoints/main-checkpoint.ipynb | 457 ++++++++++++++++++ your-code/main.ipynb | 227 +++++++-- 3 files changed, 631 insertions(+), 53 deletions(-) create mode 100644 .DS_Store create mode 100644 your-code/.ipynb_checkpoints/main-checkpoint.ipynb diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..70a47ef027476a81f0de3491953e54153d23a2cd GIT binary patch literal 6148 zcmeHKyH3ME5S)b+K{PHY?*~BQ501zwQqaH;pu}`WmXK1=x#P28_5q4!*4afK&zn|@Y(JfYk(+>v*K76<%c zx9x{5SDUvlW{ejM*y9-s`bjbnRD5KGK!;ONK|nmCo{REZ~sIGy}S;O3GO(kP7@M1!U3Qw<~^9^w!zO uX|FBx2l|Jx*2) use the lambda function to append the empty list\n", + " 5. Call the function with list and lambda expression\n", + " 6. print the updated list " + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[2, 3, 4, 5, 6, 7, 8, 9, 10, 11]\n" + ] + } + ], + "source": [ + "l = list(range(10))\n", + "f = lambda x: (x + 2) #define the lambda expression\n", + "b = []\n", + "def modify_list(lst, fudduLambda):\n", + " for x in l:\n", + " b.append(fudduLambda(x))\n", + " return(b)\n", + "\n", + "modify_list(l, f)\n", + "print(b)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Now we will define a lambda expression that will transform the elements of the list. \n", + "\n", + "In the cell below, create a lambda expression that converts Celsius to Kelvin. Recall that 0°C + 273.15 = 273.15K" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [], + "source": [ + "# Your code here:\n", + "\n", + "kelvin = lambda celsius: (celsius + 273.15)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Finally, convert the list of temperatures below from Celsius to Kelvin." + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[285.15, 296.15, 311.15, 218.14999999999998, 297.15]\n" + ] + } + ], + "source": [ + "temps_C = [12, 23, 38, -55, 24]\n", + "temps_K = []\n", + "\n", + "# Your code here:\n", + "def modify_temps(temps, fudduLambda):\n", + " for temp in temps_C:\n", + " temps_K.append(fudduLambda(temp))\n", + " return(temps_K)\n", + "\n", + "modify_temps(temps_C, kelvin)\n", + "print(temps_K)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### In this part, we will define a function that returns a lambda expression\n", + "\n", + "In the cell below, write a lambda expression that takes two numbers and returns 1 if one is divisible by the other and zero otherwise. Call the lambda expression `mod`." + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": {}, + "outputs": [], + "source": [ + "# Your code here:\n", + "\n", + "mod = (lambda a: 1 if a % b == 0 else 0)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Now create a function that returns mod. The function only takes one argument - the first number in the `mod` lambda function. \n", + "\n", + "Note: the lambda function above took two arguments, the lambda function in the return statement only takes one argument but also uses the argument passed to the function." + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "metadata": {}, + "outputs": [], + "source": [ + "def divisor(b):\n", + " \"\"\"\n", + " input: a number\n", + " output: a function that returns 1 if the number is divisible by another number (to be passed later) and zero otherwise\n", + " \"\"\"\n", + " \n", + " # Your code here:\n", + " return(lambda a: 1 if a % b == 0 else 0)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Finally, pass the number 5 to `divisor`. Now the function will check whether a number is divisble by 5. Assign this function to `divisible5`" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "metadata": {}, + "outputs": [], + "source": [ + "# Your code here:\n", + "\n", + "divisible5 = divisor(5)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Test your function with the following test cases:" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1\n" + ] + } + ], + "source": [ + "print(divisible5(10))" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n" + ] + } + ], + "source": [ + "print(divisible5(8))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Challenge 2 - Using Lambda Expressions in List Comprehensions\n", + "\n", + "In the following challenge, we will combine two lists using a lambda expression in a list comprehension. \n", + "\n", + "To do this, we will need to introduce the `zip` function. The `zip` function returns an iterator of tuples.\n", + "\n", + "The way zip function works with list has been shown below:" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[('Green', 'eggs'),\n", + " ('cheese', 'cheese'),\n", + " ('English', 'cucumber'),\n", + " ('tomato', 'tomato')]" + ] + }, + "execution_count": 66, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "list1 = ['Green', 'cheese', 'English', 'tomato']\n", + "list2 = ['eggs', 'cheese', 'cucumber', 'tomato']\n", + "zipped = zip(list1,list2)\n", + "list(zipped)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In this exercise we will try to compare the elements on the same index in the two lists. \n", + "We want to zip the two lists and then use a lambda expression to compare if:\n", + "list1 element > list2 element " + ] + }, + { + "cell_type": "code", + "execution_count": 105, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[(1, 2), (2, 3), (3, 4), (4, 5)]\n" + ] + } + ], + "source": [ + "list1 = [1,2,3,4]\n", + "list2 = [2,3,4,5]\n", + "## Zip the lists together \n", + "zipped = zip(list1,list2)\n", + "## Print the zipped list \n", + "list(zipped)" + ] + }, + { + "cell_type": "code", + "execution_count": 104, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 104, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "enumerate(zipped)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Complete the parts of the code marked as \"###\"" + ] + }, + { + "cell_type": "code", + "execution_count": 107, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "False\n", + "False\n", + "False\n", + "False\n" + ] + } + ], + "source": [ + "compare = lambda i, j: print(\"True\") if i > j else print(\"False\")\n", + "\n", + "for i, j in zip(list1, list2):\n", + " compare(i, j)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Challenge 3 - Using Lambda Expressions as Arguments\n", + "\n", + "#### In this challenge, we will zip together two lists and sort by the resulting tuple.\n", + "\n", + "In the cell below, take the two lists provided, zip them together and sort by the first letter of the second element of each tuple. Do this using a lambda function." + ] + }, + { + "cell_type": "code", + "execution_count": 109, + "metadata": {}, + "outputs": [], + "source": [ + "import re" + ] + }, + { + "cell_type": "code", + "execution_count": 152, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[('Political Science', 'Essay'),\n", + " ('Computer Science', 'Homework'),\n", + " ('Engineering', 'Lab'),\n", + " ('Mathematics', 'Module')]" + ] + }, + "execution_count": 152, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "list1 = ['Engineering', 'Computer Science', 'Political Science', 'Mathematics']\n", + "list2 = ['Lab', 'Homework', 'Essay', 'Module']\n", + " \n", + "\n", + "# Your code here:\n", + "zipped = list(zip(list1, list2))\n", + "## Print the zipped list \n", + "list(zipped)\n", + "\n", + "def Sort_Tuple(tup): \n", + " tup.sort(key = lambda x: x[1]) \n", + " return tup \n", + "\n", + "Sort_Tuple(zipped)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Bonus Challenge - Sort a Dictionary by Values\n", + "\n", + "Given the dictionary below, sort it by values rather than by keys. Use a lambda function to specify the values as a sorting key." + ] + }, + { + "cell_type": "code", + "execution_count": 161, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'Toyota': 1995, 'Honda': 1997, 'Audi': 2001, 'BMW': 2005}" + ] + }, + "execution_count": 161, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "d = {'Honda': 1997, 'Toyota': 1995, 'Audi': 2001, 'BMW': 2005}\n", + "\n", + "# Your code here:\n", + "\n", + "{k: v for k, v in sorted(d.items(), key=lambda item: item[1])}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "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.9.5" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/your-code/main.ipynb b/your-code/main.ipynb index 66a9984..5ec025b 100644 --- a/your-code/main.ipynb +++ b/your-code/main.ipynb @@ -34,18 +34,28 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[2, 3, 4, 5, 6, 7, 8, 9, 10, 11]\n" + ] + } + ], "source": [ - "l = [######]\n", - "f = lambda x: #define the lambda expression\n", + "l = list(range(10))\n", + "f = lambda x: (x + 2) #define the lambda expression\n", "b = []\n", "def modify_list(lst, fudduLambda):\n", - " for x in ####:\n", - " b.append(#####(x))\n", - "#Call modify_list(##,##)\n", - "#print b" + " for x in l:\n", + " b.append(fudduLambda(x))\n", + " return(b)\n", + "\n", + "modify_list(l, f)\n", + "print(b)" ] }, { @@ -59,12 +69,13 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "# Your code here:\n", - "\n" + "\n", + "kelvin = lambda celsius: (celsius + 273.15)" ] }, { @@ -76,13 +87,29 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 15, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[285.15, 296.15, 311.15, 218.14999999999998, 297.15]\n" + ] + } + ], "source": [ - "temps = [12, 23, 38, -55, 24]\n", + "temps_C = [12, 23, 38, -55, 24]\n", + "temps_K = []\n", + "\n", + "# Your code here:\n", + "def modify_temps(temps, fudduLambda):\n", + " for temp in temps_C:\n", + " temps_K.append(fudduLambda(temp))\n", + " return(temps_K)\n", "\n", - "# Your code here:" + "modify_temps(temps_C, kelvin)\n", + "print(temps_K)" ] }, { @@ -96,11 +123,13 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 61, "metadata": {}, "outputs": [], "source": [ - "# Your code here:\n" + "# Your code here:\n", + "\n", + "mod = (lambda a: 1 if a % b == 0 else 0)" ] }, { @@ -114,7 +143,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 62, "metadata": {}, "outputs": [], "source": [ @@ -124,7 +153,8 @@ " output: a function that returns 1 if the number is divisible by another number (to be passed later) and zero otherwise\n", " \"\"\"\n", " \n", - " # Your code here:" + " # Your code here:\n", + " return(lambda a: 1 if a % b == 0 else 0)" ] }, { @@ -136,11 +166,13 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 63, "metadata": {}, "outputs": [], "source": [ - "# Your code here:\n" + "# Your code here:\n", + "\n", + "divisible5 = divisor(5)" ] }, { @@ -152,20 +184,36 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 64, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1\n" + ] + } + ], "source": [ - "divisible5(10)" + "print(divisible5(10))" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 65, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n" + ] + } + ], "source": [ - "divisible5(8)" + "print(divisible5(8))" ] }, { @@ -183,7 +231,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 66, "metadata": {}, "outputs": [ { @@ -195,7 +243,7 @@ " ('tomato', 'tomato')]" ] }, - "execution_count": 1, + "execution_count": 66, "metadata": {}, "output_type": "execute_result" } @@ -218,47 +266,74 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 105, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[(1, 2), (2, 3), (3, 4), (4, 5)]\n" + ] + } + ], "source": [ "list1 = [1,2,3,4]\n", "list2 = [2,3,4,5]\n", "## Zip the lists together \n", - "## Print the zipped list " - ] - }, - { - "cell_type": "raw", - "metadata": {}, - "source": [ - "Complete the parts of the code marked as \"###\"" + "zipped = zip(list1,list2)\n", + "## Print the zipped list \n", + "list(zipped)" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 104, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "'\\n\\ncompare = lambda ###: print(\"True\") if ### else print(\"False\")\\nfor ### in zip(list1,list2):\\n compare(###)\\n \\n'" + "" ] }, - "execution_count": 4, + "execution_count": 104, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "'''\n", + "enumerate(zipped)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Complete the parts of the code marked as \"###\"" + ] + }, + { + "cell_type": "code", + "execution_count": 107, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "False\n", + "False\n", + "False\n", + "False\n" + ] + } + ], + "source": [ + "compare = lambda i, j: print(\"True\") if i > j else print(\"False\")\n", "\n", - "compare = lambda ###: print(\"True\") if ### else print(\"False\")\n", - "for ### in zip(list1,list2):\n", - " compare(###)\n", - " \n", - "''' " + "for i, j in zip(list1, list2):\n", + " compare(i, j)" ] }, { @@ -274,14 +349,47 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 109, "metadata": {}, "outputs": [], + "source": [ + "import re" + ] + }, + { + "cell_type": "code", + "execution_count": 152, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[('Political Science', 'Essay'),\n", + " ('Computer Science', 'Homework'),\n", + " ('Engineering', 'Lab'),\n", + " ('Mathematics', 'Module')]" + ] + }, + "execution_count": 152, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "list1 = ['Engineering', 'Computer Science', 'Political Science', 'Mathematics']\n", "list2 = ['Lab', 'Homework', 'Essay', 'Module']\n", + " \n", + "\n", + "# Your code here:\n", + "zipped = list(zip(list1, list2))\n", + "## Print the zipped list \n", + "list(zipped)\n", "\n", - "# Your code here:\n" + "def Sort_Tuple(tup): \n", + " tup.sort(key = lambda x: x[1]) \n", + " return tup \n", + "\n", + "Sort_Tuple(zipped)" ] }, { @@ -295,13 +403,26 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 161, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "{'Toyota': 1995, 'Honda': 1997, 'Audi': 2001, 'BMW': 2005}" + ] + }, + "execution_count": 161, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "d = {'Honda': 1997, 'Toyota': 1995, 'Audi': 2001, 'BMW': 2005}\n", "\n", - "# Your code here:" + "# Your code here:\n", + "\n", + "{k: v for k, v in sorted(d.items(), key=lambda item: item[1])}" ] }, { @@ -328,7 +449,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.3" + "version": "3.9.5" } }, "nbformat": 4, From 268f16729813773b4db7f4aff7dfc574354d3563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20P=C3=A9rez=20Ortega?= Date: Wed, 21 Jul 2021 21:45:46 -0500 Subject: [PATCH 2/2] Lab terminado --- .../.ipynb_checkpoints/main-checkpoint.ipynb | 60 +++++++++---------- your-code/main.ipynb | 60 +++++++++---------- 2 files changed, 56 insertions(+), 64 deletions(-) diff --git a/your-code/.ipynb_checkpoints/main-checkpoint.ipynb b/your-code/.ipynb_checkpoints/main-checkpoint.ipynb index 5ec025b..aadad51 100644 --- a/your-code/.ipynb_checkpoints/main-checkpoint.ipynb +++ b/your-code/.ipynb_checkpoints/main-checkpoint.ipynb @@ -34,7 +34,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -69,7 +69,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -87,7 +87,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -123,7 +123,7 @@ }, { "cell_type": "code", - "execution_count": 61, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -143,7 +143,7 @@ }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -166,7 +166,7 @@ }, { "cell_type": "code", - "execution_count": 63, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -184,7 +184,7 @@ }, { "cell_type": "code", - "execution_count": 64, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -201,7 +201,7 @@ }, { "cell_type": "code", - "execution_count": 65, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -231,7 +231,7 @@ }, { "cell_type": "code", - "execution_count": 66, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -243,7 +243,7 @@ " ('tomato', 'tomato')]" ] }, - "execution_count": 66, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -266,15 +266,18 @@ }, { "cell_type": "code", - "execution_count": 105, + "execution_count": 10, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "[(1, 2), (2, 3), (3, 4), (4, 5)]\n" - ] + "data": { + "text/plain": [ + "[(1, 2), (2, 3), (3, 4), (4, 5)]" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -288,16 +291,16 @@ }, { "cell_type": "code", - "execution_count": 104, + "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 104, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -315,7 +318,7 @@ }, { "cell_type": "code", - "execution_count": 107, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -349,7 +352,7 @@ }, { "cell_type": "code", - "execution_count": 109, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ @@ -358,7 +361,7 @@ }, { "cell_type": "code", - "execution_count": 152, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -370,7 +373,7 @@ " ('Mathematics', 'Module')]" ] }, - "execution_count": 152, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -403,7 +406,7 @@ }, { "cell_type": "code", - "execution_count": 161, + "execution_count": 15, "metadata": {}, "outputs": [ { @@ -412,7 +415,7 @@ "{'Toyota': 1995, 'Honda': 1997, 'Audi': 2001, 'BMW': 2005}" ] }, - "execution_count": 161, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -424,13 +427,6 @@ "\n", "{k: v for k, v in sorted(d.items(), key=lambda item: item[1])}" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/your-code/main.ipynb b/your-code/main.ipynb index 5ec025b..aadad51 100644 --- a/your-code/main.ipynb +++ b/your-code/main.ipynb @@ -34,7 +34,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -69,7 +69,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -87,7 +87,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -123,7 +123,7 @@ }, { "cell_type": "code", - "execution_count": 61, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -143,7 +143,7 @@ }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -166,7 +166,7 @@ }, { "cell_type": "code", - "execution_count": 63, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -184,7 +184,7 @@ }, { "cell_type": "code", - "execution_count": 64, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -201,7 +201,7 @@ }, { "cell_type": "code", - "execution_count": 65, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -231,7 +231,7 @@ }, { "cell_type": "code", - "execution_count": 66, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -243,7 +243,7 @@ " ('tomato', 'tomato')]" ] }, - "execution_count": 66, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -266,15 +266,18 @@ }, { "cell_type": "code", - "execution_count": 105, + "execution_count": 10, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "[(1, 2), (2, 3), (3, 4), (4, 5)]\n" - ] + "data": { + "text/plain": [ + "[(1, 2), (2, 3), (3, 4), (4, 5)]" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -288,16 +291,16 @@ }, { "cell_type": "code", - "execution_count": 104, + "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 104, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -315,7 +318,7 @@ }, { "cell_type": "code", - "execution_count": 107, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -349,7 +352,7 @@ }, { "cell_type": "code", - "execution_count": 109, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ @@ -358,7 +361,7 @@ }, { "cell_type": "code", - "execution_count": 152, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -370,7 +373,7 @@ " ('Mathematics', 'Module')]" ] }, - "execution_count": 152, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -403,7 +406,7 @@ }, { "cell_type": "code", - "execution_count": 161, + "execution_count": 15, "metadata": {}, "outputs": [ { @@ -412,7 +415,7 @@ "{'Toyota': 1995, 'Honda': 1997, 'Audi': 2001, 'BMW': 2005}" ] }, - "execution_count": 161, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -424,13 +427,6 @@ "\n", "{k: v for k, v in sorted(d.items(), key=lambda item: item[1])}" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": {