From 2e74835e5bde8693a27806700a130733cc30916f Mon Sep 17 00:00:00 2001 From: gsingh58 <gurmail.singh@wisc.edu> Date: Fri, 3 Feb 2023 01:40:51 -0500 Subject: [PATCH] lec5 notebooks added --- .../lec_05_Using_Functions.ipynb | 563 ++++++++++++++++-- ...ing_Functions_template_Gurmail_lec1.ipynb} | 2 +- ...ing_Functions_template_Gurmail_lec2.ipynb} | 280 ++------- 3 files changed, 562 insertions(+), 283 deletions(-) rename s23/Gurmail_lecture_notes/05_Using_Functions/{lec_05_Using_Functions_template.ipynb => lec_05_Using_Functions_template_Gurmail_lec1.ipynb} (99%) rename s23/Gurmail_lecture_notes/05_Using_Functions/{.ipynb_checkpoints/lec_05_Using_Functions-checkpoint.ipynb => lec_05_Using_Functions_template_Gurmail_lec2.ipynb} (98%) diff --git a/s23/Gurmail_lecture_notes/05_Using_Functions/lec_05_Using_Functions.ipynb b/s23/Gurmail_lecture_notes/05_Using_Functions/lec_05_Using_Functions.ipynb index 0e49d35..2aa5074 100644 --- a/s23/Gurmail_lecture_notes/05_Using_Functions/lec_05_Using_Functions.ipynb +++ b/s23/Gurmail_lecture_notes/05_Using_Functions/lec_05_Using_Functions.ipynb @@ -41,17 +41,27 @@ "output_type": "stream", "text": [ "False\n", - "True\n", "True\n" ] + }, + { + "ename": "ZeroDivisionError", + "evalue": "division by zero", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mZeroDivisionError\u001b[0m Traceback (most recent call last)", + "Input \u001b[1;32mIn [1]\u001b[0m, in \u001b[0;36m<cell line: 3>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;241m7\u001b[39m\u001b[38;5;241m+\u001b[39m\u001b[38;5;241m3\u001b[39m \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m9\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;241m4\u001b[39m\u001b[38;5;241m/\u001b[39m\u001b[38;5;241m0\u001b[39m \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m0\u001b[39m) \u001b[38;5;66;03m# False\u001b[39;00m\n\u001b[0;32m 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;241m7\u001b[39m \u001b[38;5;241m+\u001b[39m \u001b[38;5;241m3\u001b[39m \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m10\u001b[39m \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;241m4\u001b[39m\u001b[38;5;241m/\u001b[39m\u001b[38;5;241m0\u001b[39m \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m0\u001b[39m) \u001b[38;5;66;03m# True\u001b[39;00m\n\u001b[1;32m----> 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;241;43m4\u001b[39;49m\u001b[38;5;241;43m/\u001b[39;49m\u001b[38;5;241;43m0\u001b[39;49m \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m0\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;241m7\u001b[39m\u001b[38;5;241m+\u001b[39m\u001b[38;5;241m3\u001b[39m \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m9\u001b[39m)\n", + "\u001b[1;31mZeroDivisionError\u001b[0m: division by zero" + ] } ], "source": [ "print(7+3 == 9 and 4/0 == 0) # False\n", "print(7 + 3 == 10 or 4/0 == 0) # True\n", - "#print(4/0 == 0 and 7+3 == 9) # ZeroDivisionError\n", + "print(4/0 == 0 and 7+3 == 9) # ZeroDivisionError\n", "#print(4/0 == 0 or 7+3 == 10) # ZeroDivisionError\n", - "print(4+5 == 9 or 5**10000000 < 10000000) # True" + "# print(4+5 == 9 or 5**10000000 < 10000000) # True" ] }, { @@ -239,9 +249,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "Enter your name: Meena\n", + "Enter your name: Gurmail\n", "<class 'str'>\n", - "Hello Meena!\n" + "Hello Gurmail!\n" ] } ], @@ -269,7 +279,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Enter your age: 10\n", + "Enter your age: 38\n", "<class 'str'>\n" ] }, @@ -278,10 +288,10 @@ "evalue": "can only concatenate str (not \"int\") to str", "output_type": "error", "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "Input \u001b[0;32mIn [7]\u001b[0m, in \u001b[0;36m<cell line: 5>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28mtype\u001b[39m(age))\n\u001b[1;32m 4\u001b[0m \u001b[38;5;66;03m# Let's celebrate a birthday :)\u001b[39;00m\n\u001b[0;32m----> 5\u001b[0m age \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;241m1\u001b[39m \u001b[38;5;66;03m# What is wrong?\u001b[39;00m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28mprint\u001b[39m(age)\n", - "\u001b[0;31mTypeError\u001b[0m: can only concatenate str (not \"int\") to str" + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", + "Input \u001b[1;32mIn [7]\u001b[0m, in \u001b[0;36m<cell line: 5>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28mtype\u001b[39m(age))\n\u001b[0;32m 4\u001b[0m \u001b[38;5;66;03m# Let's celebrate a birthday :)\u001b[39;00m\n\u001b[1;32m----> 5\u001b[0m age \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;241m1\u001b[39m \u001b[38;5;66;03m# What is wrong?\u001b[39;00m\n\u001b[0;32m 6\u001b[0m \u001b[38;5;28mprint\u001b[39m(age)\n", + "\u001b[1;31mTypeError\u001b[0m: can only concatenate str (not \"int\") to str" ] } ], @@ -321,10 +331,10 @@ "evalue": "invalid literal for int() with base 10: 'nineteen'", "output_type": "error", "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", - "Input \u001b[0;32mIn [8]\u001b[0m, in \u001b[0;36m<cell line: 6>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28mint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m2012\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;241m+\u001b[39m \u001b[38;5;241m10\u001b[39m)\n\u001b[1;32m 4\u001b[0m \u001b[38;5;66;03m# Some conversions don't make sense to us\u001b[39;00m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;66;03m# So they won't make sense to Python either\u001b[39;00m\n\u001b[0;32m----> 6\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28;43mint\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mnineteen\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m)\n", - "\u001b[0;31mValueError\u001b[0m: invalid literal for int() with base 10: 'nineteen'" + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)", + "Input \u001b[1;32mIn [8]\u001b[0m, in \u001b[0;36m<cell line: 6>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28mint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m2012\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;241m+\u001b[39m \u001b[38;5;241m10\u001b[39m)\n\u001b[0;32m 4\u001b[0m \u001b[38;5;66;03m# Some conversions don't make sense to us\u001b[39;00m\n\u001b[0;32m 5\u001b[0m \u001b[38;5;66;03m# So they won't make sense to Python either\u001b[39;00m\n\u001b[1;32m----> 6\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28;43mint\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mnineteen\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m)\n", + "\u001b[1;31mValueError\u001b[0m: invalid literal for int() with base 10: 'nineteen'" ] } ], @@ -355,10 +365,10 @@ "evalue": "invalid literal for int() with base 10: '32.5'", "output_type": "error", "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", - "Input \u001b[0;32mIn [9]\u001b[0m, in \u001b[0;36m<cell line: 5>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28mint\u001b[39m(\u001b[38;5;28mfloat\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m32.5\u001b[39m\u001b[38;5;124m\"\u001b[39m))) \u001b[38;5;66;03m# this works\u001b[39;00m\n\u001b[1;32m 4\u001b[0m \u001b[38;5;66;03m# this doesn't work, less intuitive (tricky case!)\u001b[39;00m\n\u001b[0;32m----> 5\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28;43mint\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m32.5\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m)\n", - "\u001b[0;31mValueError\u001b[0m: invalid literal for int() with base 10: '32.5'" + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)", + "Input \u001b[1;32mIn [9]\u001b[0m, in \u001b[0;36m<cell line: 5>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28mint\u001b[39m(\u001b[38;5;28mfloat\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m32.5\u001b[39m\u001b[38;5;124m\"\u001b[39m))) \u001b[38;5;66;03m# this works\u001b[39;00m\n\u001b[0;32m 4\u001b[0m \u001b[38;5;66;03m# this doesn't work, less intuitive (tricky case!)\u001b[39;00m\n\u001b[1;32m----> 5\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28;43mint\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m32.5\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m)\n", + "\u001b[1;31mValueError\u001b[0m: invalid literal for int() with base 10: '32.5'" ] } ], @@ -388,10 +398,10 @@ "evalue": "could not convert string to float: 'three point one'", "output_type": "error", "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", - "Input \u001b[0;32mIn [10]\u001b[0m, in \u001b[0;36m<cell line: 6>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28mfloat\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m3.14\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;241m*\u001b[39m \u001b[38;5;241m2\u001b[39m)\n\u001b[1;32m 4\u001b[0m \u001b[38;5;66;03m# Some conversions don't make sense to us\u001b[39;00m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;66;03m# So they won't make sense to Python either\u001b[39;00m\n\u001b[0;32m----> 6\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28;43mfloat\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mthree point one\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m)\n", - "\u001b[0;31mValueError\u001b[0m: could not convert string to float: 'three point one'" + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)", + "Input \u001b[1;32mIn [10]\u001b[0m, in \u001b[0;36m<cell line: 6>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28mfloat\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m3.14\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;241m*\u001b[39m \u001b[38;5;241m2\u001b[39m)\n\u001b[0;32m 4\u001b[0m \u001b[38;5;66;03m# Some conversions don't make sense to us\u001b[39;00m\n\u001b[0;32m 5\u001b[0m \u001b[38;5;66;03m# So they won't make sense to Python either\u001b[39;00m\n\u001b[1;32m----> 6\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28;43mfloat\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mthree point one\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m)\n", + "\u001b[1;31mValueError\u001b[0m: could not convert string to float: 'three point one'" ] } ], @@ -444,8 +454,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "Enter your age: 10\n", - "11\n" + "Enter your age: 38\n", + "39\n" ] } ], @@ -474,7 +484,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Enter your temperature: 98.5\n", + "Enter your temperature: 70\n", "<class 'bool'>\n", "OK to enter: True\n" ] @@ -500,7 +510,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Somebody had a birthday: Meena 11 years old :)\n" + "Somebody had a birthday: Gurmail 39 years old :)\n" ] } ], @@ -525,9 +535,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hello world\n", + "hello cs220/cs319\n" + ] + } + ], "source": [ "# Instead of using + (concatenation) operator, we could pass multiple arguments to print\n", "print(\"hello\", \"world\")\n", @@ -536,9 +555,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hello---cs220/cs319\n", + "hello cs220/cs319!!!\n" + ] + } + ], "source": [ "print(\"hello\", \"cs220/cs319\", sep = \"---\")\n", "print(\"hello\", \"cs220/cs319\", end = \"!!!\\n\")" @@ -546,13 +574,25 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hello|world;\n", + "hello^world...\n", + "****||######<END>******||########<END>\n", + "****||######<END>\n", + "******||########<END>\n" + ] + } + ], "source": [ "# Self-practic: Guess what will get printed\n", "print(\"hello\", \"world\", sep = \"|\", end = \";\\n\")\n", - "print(\"hello\", \"meena\", sep = \"^\", end = \"...\\n\")\n", + "print(\"hello\", \"world\", sep = \"^\", end = \"...\\n\")\n", "\n", "print(\"*\" * 4, \"#\" * 6, sep = \"||\", end = \"<END>\")\n", "print(\"*\" * 6, \"#\" * 8, sep = \"||\", end = \"<END>\")\n", @@ -582,9 +622,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "10\n", + "10\n" + ] + } + ], "source": [ "# Guess what will get printed\n", "print(abs(-10))\n", @@ -600,9 +649,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "10.5253\n", + "5.3\n", + "5.24\n" + ] + } + ], "source": [ "# Guess what will get printed\n", "print(round(10.525252, 4))\n", @@ -630,9 +689,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'sqrt' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", + "Input \u001b[1;32mIn [20]\u001b[0m, in \u001b[0;36m<cell line: 2>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;66;03m# Let's try to find square root of 10\u001b[39;00m\n\u001b[1;32m----> 2\u001b[0m \u001b[43msqrt\u001b[49m(\u001b[38;5;241m10\u001b[39m)\n", + "\u001b[1;31mNameError\u001b[0m: name 'sqrt' is not defined" + ] + } + ], "source": [ "# Let's try to find square root of 10\n", "sqrt(10) # doesn't work because it is part of math module" @@ -647,7 +718,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "metadata": {}, "outputs": [], "source": [ @@ -656,18 +727,40 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "3.1622776601683795" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "math.sqrt(10)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "-0.9999999999964793" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "math.cos(3.14159)" ] @@ -681,18 +774,317 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "3.141592653589793" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "math.pi" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Help on built-in module math:\n", + "\n", + "NAME\n", + " math\n", + "\n", + "DESCRIPTION\n", + " This module provides access to the mathematical functions\n", + " defined by the C standard.\n", + "\n", + "FUNCTIONS\n", + " acos(x, /)\n", + " Return the arc cosine (measured in radians) of x.\n", + " \n", + " The result is between 0 and pi.\n", + " \n", + " acosh(x, /)\n", + " Return the inverse hyperbolic cosine of x.\n", + " \n", + " asin(x, /)\n", + " Return the arc sine (measured in radians) of x.\n", + " \n", + " The result is between -pi/2 and pi/2.\n", + " \n", + " asinh(x, /)\n", + " Return the inverse hyperbolic sine of x.\n", + " \n", + " atan(x, /)\n", + " Return the arc tangent (measured in radians) of x.\n", + " \n", + " The result is between -pi/2 and pi/2.\n", + " \n", + " atan2(y, x, /)\n", + " Return the arc tangent (measured in radians) of y/x.\n", + " \n", + " Unlike atan(y/x), the signs of both x and y are considered.\n", + " \n", + " atanh(x, /)\n", + " Return the inverse hyperbolic tangent of x.\n", + " \n", + " ceil(x, /)\n", + " Return the ceiling of x as an Integral.\n", + " \n", + " This is the smallest integer >= x.\n", + " \n", + " comb(n, k, /)\n", + " Number of ways to choose k items from n items without repetition and without order.\n", + " \n", + " Evaluates to n! / (k! * (n - k)!) when k <= n and evaluates\n", + " to zero when k > n.\n", + " \n", + " Also called the binomial coefficient because it is equivalent\n", + " to the coefficient of k-th term in polynomial expansion of the\n", + " expression (1 + x)**n.\n", + " \n", + " Raises TypeError if either of the arguments are not integers.\n", + " Raises ValueError if either of the arguments are negative.\n", + " \n", + " copysign(x, y, /)\n", + " Return a float with the magnitude (absolute value) of x but the sign of y.\n", + " \n", + " On platforms that support signed zeros, copysign(1.0, -0.0)\n", + " returns -1.0.\n", + " \n", + " cos(x, /)\n", + " Return the cosine of x (measured in radians).\n", + " \n", + " cosh(x, /)\n", + " Return the hyperbolic cosine of x.\n", + " \n", + " degrees(x, /)\n", + " Convert angle x from radians to degrees.\n", + " \n", + " dist(p, q, /)\n", + " Return the Euclidean distance between two points p and q.\n", + " \n", + " The points should be specified as sequences (or iterables) of\n", + " coordinates. Both inputs must have the same dimension.\n", + " \n", + " Roughly equivalent to:\n", + " sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))\n", + " \n", + " erf(x, /)\n", + " Error function at x.\n", + " \n", + " erfc(x, /)\n", + " Complementary error function at x.\n", + " \n", + " exp(x, /)\n", + " Return e raised to the power of x.\n", + " \n", + " expm1(x, /)\n", + " Return exp(x)-1.\n", + " \n", + " This function avoids the loss of precision involved in the direct evaluation of exp(x)-1 for small x.\n", + " \n", + " fabs(x, /)\n", + " Return the absolute value of the float x.\n", + " \n", + " factorial(x, /)\n", + " Find x!.\n", + " \n", + " Raise a ValueError if x is negative or non-integral.\n", + " \n", + " floor(x, /)\n", + " Return the floor of x as an Integral.\n", + " \n", + " This is the largest integer <= x.\n", + " \n", + " fmod(x, y, /)\n", + " Return fmod(x, y), according to platform C.\n", + " \n", + " x % y may differ.\n", + " \n", + " frexp(x, /)\n", + " Return the mantissa and exponent of x, as pair (m, e).\n", + " \n", + " m is a float and e is an int, such that x = m * 2.**e.\n", + " If x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0.\n", + " \n", + " fsum(seq, /)\n", + " Return an accurate floating point sum of values in the iterable seq.\n", + " \n", + " Assumes IEEE-754 floating point arithmetic.\n", + " \n", + " gamma(x, /)\n", + " Gamma function at x.\n", + " \n", + " gcd(*integers)\n", + " Greatest Common Divisor.\n", + " \n", + " hypot(...)\n", + " hypot(*coordinates) -> value\n", + " \n", + " Multidimensional Euclidean distance from the origin to a point.\n", + " \n", + " Roughly equivalent to:\n", + " sqrt(sum(x**2 for x in coordinates))\n", + " \n", + " For a two dimensional point (x, y), gives the hypotenuse\n", + " using the Pythagorean theorem: sqrt(x*x + y*y).\n", + " \n", + " For example, the hypotenuse of a 3/4/5 right triangle is:\n", + " \n", + " >>> hypot(3.0, 4.0)\n", + " 5.0\n", + " \n", + " isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0)\n", + " Determine whether two floating point numbers are close in value.\n", + " \n", + " rel_tol\n", + " maximum difference for being considered \"close\", relative to the\n", + " magnitude of the input values\n", + " abs_tol\n", + " maximum difference for being considered \"close\", regardless of the\n", + " magnitude of the input values\n", + " \n", + " Return True if a is close in value to b, and False otherwise.\n", + " \n", + " For the values to be considered close, the difference between them\n", + " must be smaller than at least one of the tolerances.\n", + " \n", + " -inf, inf and NaN behave similarly to the IEEE 754 Standard. That\n", + " is, NaN is not close to anything, even itself. inf and -inf are\n", + " only close to themselves.\n", + " \n", + " isfinite(x, /)\n", + " Return True if x is neither an infinity nor a NaN, and False otherwise.\n", + " \n", + " isinf(x, /)\n", + " Return True if x is a positive or negative infinity, and False otherwise.\n", + " \n", + " isnan(x, /)\n", + " Return True if x is a NaN (not a number), and False otherwise.\n", + " \n", + " isqrt(n, /)\n", + " Return the integer part of the square root of the input.\n", + " \n", + " lcm(*integers)\n", + " Least Common Multiple.\n", + " \n", + " ldexp(x, i, /)\n", + " Return x * (2**i).\n", + " \n", + " This is essentially the inverse of frexp().\n", + " \n", + " lgamma(x, /)\n", + " Natural logarithm of absolute value of Gamma function at x.\n", + " \n", + " log(...)\n", + " log(x, [base=math.e])\n", + " Return the logarithm of x to the given base.\n", + " \n", + " If the base not specified, returns the natural logarithm (base e) of x.\n", + " \n", + " log10(x, /)\n", + " Return the base 10 logarithm of x.\n", + " \n", + " log1p(x, /)\n", + " Return the natural logarithm of 1+x (base e).\n", + " \n", + " The result is computed in a way which is accurate for x near zero.\n", + " \n", + " log2(x, /)\n", + " Return the base 2 logarithm of x.\n", + " \n", + " modf(x, /)\n", + " Return the fractional and integer parts of x.\n", + " \n", + " Both results carry the sign of x and are floats.\n", + " \n", + " nextafter(x, y, /)\n", + " Return the next floating-point value after x towards y.\n", + " \n", + " perm(n, k=None, /)\n", + " Number of ways to choose k items from n items without repetition and with order.\n", + " \n", + " Evaluates to n! / (n - k)! when k <= n and evaluates\n", + " to zero when k > n.\n", + " \n", + " If k is not specified or is None, then k defaults to n\n", + " and the function returns n!.\n", + " \n", + " Raises TypeError if either of the arguments are not integers.\n", + " Raises ValueError if either of the arguments are negative.\n", + " \n", + " pow(x, y, /)\n", + " Return x**y (x to the power of y).\n", + " \n", + " prod(iterable, /, *, start=1)\n", + " Calculate the product of all the elements in the input iterable.\n", + " \n", + " The default start value for the product is 1.\n", + " \n", + " When the iterable is empty, return the start value. This function is\n", + " intended specifically for use with numeric values and may reject\n", + " non-numeric types.\n", + " \n", + " radians(x, /)\n", + " Convert angle x from degrees to radians.\n", + " \n", + " remainder(x, y, /)\n", + " Difference between x and the closest integer multiple of y.\n", + " \n", + " Return x - n*y where n*y is the closest integer multiple of y.\n", + " In the case where x is exactly halfway between two multiples of\n", + " y, the nearest even value of n is used. The result is always exact.\n", + " \n", + " sin(x, /)\n", + " Return the sine of x (measured in radians).\n", + " \n", + " sinh(x, /)\n", + " Return the hyperbolic sine of x.\n", + " \n", + " sqrt(x, /)\n", + " Return the square root of x.\n", + " \n", + " tan(x, /)\n", + " Return the tangent of x (measured in radians).\n", + " \n", + " tanh(x, /)\n", + " Return the hyperbolic tangent of x.\n", + " \n", + " trunc(x, /)\n", + " Truncates the Real x to the nearest Integral toward 0.\n", + " \n", + " Uses the __trunc__ magic method.\n", + " \n", + " ulp(x, /)\n", + " Return the value of the least significant bit of the float x.\n", + "\n", + "DATA\n", + " e = 2.718281828459045\n", + " inf = inf\n", + " nan = nan\n", + " pi = 3.141592653589793\n", + " tau = 6.283185307179586\n", + "\n", + "FILE\n", + " (built-in)\n", + "\n", + "\n" + ] + } + ], "source": [ "# Let's get help\n", "help(math)" @@ -700,7 +1092,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "metadata": {}, "outputs": [], "source": [ @@ -709,21 +1101,84 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "5\n" + ] + } + ], "source": [ "print(randint(1,10)) # correct invocation" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'random' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", + "Input \u001b[1;32mIn [28]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[43mrandom\u001b[49m\u001b[38;5;241m.\u001b[39mrandint(\u001b[38;5;241m1\u001b[39m,\u001b[38;5;241m10\u001b[39m))\n", + "\u001b[1;31mNameError\u001b[0m: name 'random' is not defined" + ] + } + ], "source": [ "print(random.randint(1,10)) # incorrect invocation" ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [], + "source": [ + "import random" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "6\n" + ] + } + ], + "source": [ + "print(random.randint(1,10))" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2.1271689697278386\n" + ] + } + ], + "source": [ + "print(random.uniform(1,10))" + ] } ], "metadata": { @@ -742,7 +1197,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.9.12" } }, "nbformat": 4, diff --git a/s23/Gurmail_lecture_notes/05_Using_Functions/lec_05_Using_Functions_template.ipynb b/s23/Gurmail_lecture_notes/05_Using_Functions/lec_05_Using_Functions_template_Gurmail_lec1.ipynb similarity index 99% rename from s23/Gurmail_lecture_notes/05_Using_Functions/lec_05_Using_Functions_template.ipynb rename to s23/Gurmail_lecture_notes/05_Using_Functions/lec_05_Using_Functions_template_Gurmail_lec1.ipynb index 652411a..7ceadff 100644 --- a/s23/Gurmail_lecture_notes/05_Using_Functions/lec_05_Using_Functions_template.ipynb +++ b/s23/Gurmail_lecture_notes/05_Using_Functions/lec_05_Using_Functions_template_Gurmail_lec1.ipynb @@ -376,7 +376,7 @@ "source": [ "# Self-practic: Guess what will get printed\n", "print(\"hello\", \"world\", sep = \"|\", end = \";\\n\")\n", - "print(\"hello\", \"meena\", sep = \"^\", end = \"...\\n\")\n", + "print(\"hello\", \"world\", sep = \"^\", end = \"...\\n\")\n", "\n", "print(\"*\" * 4, \"#\" * 6, sep = \"||\", end = \"<END>\")\n", "print(\"*\" * 6, \"#\" * 8, sep = \"||\", end = \"<END>\")\n", diff --git a/s23/Gurmail_lecture_notes/05_Using_Functions/.ipynb_checkpoints/lec_05_Using_Functions-checkpoint.ipynb b/s23/Gurmail_lecture_notes/05_Using_Functions/lec_05_Using_Functions_template_Gurmail_lec2.ipynb similarity index 98% rename from s23/Gurmail_lecture_notes/05_Using_Functions/.ipynb_checkpoints/lec_05_Using_Functions-checkpoint.ipynb rename to s23/Gurmail_lecture_notes/05_Using_Functions/lec_05_Using_Functions_template_Gurmail_lec2.ipynb index 0e49d35..7ceadff 100644 --- a/s23/Gurmail_lecture_notes/05_Using_Functions/.ipynb_checkpoints/lec_05_Using_Functions-checkpoint.ipynb +++ b/s23/Gurmail_lecture_notes/05_Using_Functions/lec_05_Using_Functions_template_Gurmail_lec2.ipynb @@ -33,19 +33,9 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "False\n", - "True\n", - "True\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "print(7+3 == 9 and 4/0 == 0) # False\n", "print(7 + 3 == 10 or 4/0 == 0) # True\n", @@ -127,38 +117,18 @@ }, { "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "hello\n", - "world\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "print(\"hello\\nworld\")" ] }, { "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "int" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "type(1)" ] @@ -172,17 +142,9 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "<class 'bool'>\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "t = type(1 == 1.0)\n", "print(t)" @@ -197,17 +159,9 @@ }, { "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "<class 'bool'>\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "print(type(1 == 1.0))" ] @@ -232,24 +186,14 @@ }, { "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Enter your name: Meena\n", - "<class 'str'>\n", - "Hello Meena!\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "#TODO: call input function and capture the return value into a variable called \"name\"\n", - "name = input(\"Enter your name: \")\n", + "\n", "#TODO: print type of the variable name\n", - "print(type(name))\n", + "\n", "print(\"Hello \" + name + \"!\")" ] }, @@ -262,35 +206,15 @@ }, { "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Enter your age: 10\n", - "<class 'str'>\n" - ] - }, - { - "ename": "TypeError", - "evalue": "can only concatenate str (not \"int\") to str", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "Input \u001b[0;32mIn [7]\u001b[0m, in \u001b[0;36m<cell line: 5>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28mtype\u001b[39m(age))\n\u001b[1;32m 4\u001b[0m \u001b[38;5;66;03m# Let's celebrate a birthday :)\u001b[39;00m\n\u001b[0;32m----> 5\u001b[0m age \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;241m1\u001b[39m \u001b[38;5;66;03m# What is wrong?\u001b[39;00m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28mprint\u001b[39m(age)\n", - "\u001b[0;31mTypeError\u001b[0m: can only concatenate str (not \"int\") to str" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "age = input(\"Enter your age: \")\n", "#TODO: print type of the variable age\n", - "print(type(age))\n", + "\n", "# Let's celebrate a birthday :)\n", - "age += 1 # What is wrong?\n", + "age ??? 1 # What is wrong?\n", "print(age)" ] }, @@ -305,29 +229,9 @@ }, { "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "32\n", - "2022\n" - ] - }, - { - "ename": "ValueError", - "evalue": "invalid literal for int() with base 10: 'nineteen'", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", - "Input \u001b[0;32mIn [8]\u001b[0m, in \u001b[0;36m<cell line: 6>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28mint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m2012\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;241m+\u001b[39m \u001b[38;5;241m10\u001b[39m)\n\u001b[1;32m 4\u001b[0m \u001b[38;5;66;03m# Some conversions don't make sense to us\u001b[39;00m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;66;03m# So they won't make sense to Python either\u001b[39;00m\n\u001b[0;32m----> 6\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28;43mint\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mnineteen\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m)\n", - "\u001b[0;31mValueError\u001b[0m: invalid literal for int() with base 10: 'nineteen'" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Let's try these int conversions\n", "print(int(32.5))\n", @@ -339,29 +243,9 @@ }, { "cell_type": "code", - "execution_count": 9, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "32\n", - "32\n" - ] - }, - { - "ename": "ValueError", - "evalue": "invalid literal for int() with base 10: '32.5'", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", - "Input \u001b[0;32mIn [9]\u001b[0m, in \u001b[0;36m<cell line: 5>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28mint\u001b[39m(\u001b[38;5;28mfloat\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m32.5\u001b[39m\u001b[38;5;124m\"\u001b[39m))) \u001b[38;5;66;03m# this works\u001b[39;00m\n\u001b[1;32m 4\u001b[0m \u001b[38;5;66;03m# this doesn't work, less intuitive (tricky case!)\u001b[39;00m\n\u001b[0;32m----> 5\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28;43mint\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m32.5\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m)\n", - "\u001b[0;31mValueError\u001b[0m: invalid literal for int() with base 10: '32.5'" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "print(int(32.5)) # this works\n", "print(int(float(\"32.5\"))) # this works\n", @@ -372,29 +256,9 @@ }, { "cell_type": "code", - "execution_count": 10, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "26.0\n", - "6.28\n" - ] - }, - { - "ename": "ValueError", - "evalue": "could not convert string to float: 'three point one'", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", - "Input \u001b[0;32mIn [10]\u001b[0m, in \u001b[0;36m<cell line: 6>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28mfloat\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m3.14\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;241m*\u001b[39m \u001b[38;5;241m2\u001b[39m)\n\u001b[1;32m 4\u001b[0m \u001b[38;5;66;03m# Some conversions don't make sense to us\u001b[39;00m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;66;03m# So they won't make sense to Python either\u001b[39;00m\n\u001b[0;32m----> 6\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28;43mfloat\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mthree point one\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m)\n", - "\u001b[0;31mValueError\u001b[0m: could not convert string to float: 'three point one'" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Let's try these float conversions\n", "print(float(26))\n", @@ -406,23 +270,13 @@ }, { "cell_type": "code", - "execution_count": 11, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Next year will be: 2023\n", - "It is good to be: True\n", - "Who wants a pi? 3.14\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Let's try these str conversions\n", "year = 2022\n", - "print(\"Next year will be: \" + str(year+1))\n", + "print(\"Next year will be: \" + year+1)\n", "print(\"It is good to be: \" + str(True))\n", "print(\"Who wants a pi? \" + str(3.14))\n", "#Pretty much you can convert anything to string in Python" @@ -437,18 +291,9 @@ }, { "cell_type": "code", - "execution_count": 12, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Enter your age: 10\n", - "11\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "age = input(\"Enter your age: \")\n", "#TODO: convert age to int type\n", @@ -467,19 +312,9 @@ }, { "cell_type": "code", - "execution_count": 13, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Enter your temperature: 98.5\n", - "<class 'bool'>\n", - "OK to enter: True\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# To enter their day care, kids have their temp checked\n", "temp = float(input(\"Enter your temperature: \"))\n", @@ -493,17 +328,9 @@ }, { "cell_type": "code", - "execution_count": 14, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Somebody had a birthday: Meena 11 years old :)\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# TODO: figure out how this works\n", "print(\"Somebody had a birthday: \" + name + \" \" + str(age) + \" years old :)\")\n", @@ -530,8 +357,8 @@ "outputs": [], "source": [ "# Instead of using + (concatenation) operator, we could pass multiple arguments to print\n", - "print(\"hello\", \"world\")\n", - "print(\"hello\", \"cs220/cs319\")" + "print(\"hello\" + \" world\")\n", + "print(\"hello\" + \" cs220/cs319\")" ] }, { @@ -539,10 +366,7 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [ - "print(\"hello\", \"cs220/cs319\", sep = \"---\")\n", - "print(\"hello\", \"cs220/cs319\", end = \"!!!\\n\")" - ] + "source": [] }, { "cell_type": "code", @@ -552,7 +376,7 @@ "source": [ "# Self-practic: Guess what will get printed\n", "print(\"hello\", \"world\", sep = \"|\", end = \";\\n\")\n", - "print(\"hello\", \"meena\", sep = \"^\", end = \"...\\n\")\n", + "print(\"hello\", \"world\", sep = \"^\", end = \"...\\n\")\n", "\n", "print(\"*\" * 4, \"#\" * 6, sep = \"||\", end = \"<END>\")\n", "print(\"*\" * 6, \"#\" * 8, sep = \"||\", end = \"<END>\")\n", @@ -742,7 +566,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.9.12" } }, "nbformat": 4, -- GitLab