From 4142f2777babadda4b274b62f2c6e8fad1a5b71e Mon Sep 17 00:00:00 2001 From: Venice Hartwell Date: Thu, 7 Jul 2022 16:49:11 +0200 Subject: [PATCH] [Venice Hartwell] lab-functions --- main.ipynb | 571 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 522 insertions(+), 49 deletions(-) diff --git a/main.ipynb b/main.ipynb index 73f285a..68c6ade 100644 --- a/main.ipynb +++ b/main.ipynb @@ -20,7 +20,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -37,19 +37,38 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "def greater(a,b):\n", - " pass" + " if a > b:\n", + " return a\n", + " elif a < b:\n", + " return b\n", + " elif a == b:\n", + " return 'equal'\n", + " else:\n", + " return 'err'" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "....................................................................................................\n", + "----------------------------------------------------------------------\n", + "Ran 100 tests in 0.112s\n", + "\n", + "OK\n" + ] + } + ], "source": [ "# This will test your function \n", "test_greater(greater)" @@ -64,19 +83,37 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "def greatest(arr):\n", - " pass" + " greatest = arr[0]\n", + " for x in arr:\n", + " if greatest < x:\n", + " greatest = x\n", + " return greatest\n", + "\n", + "# can come back and use lambda here!" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "....................................................................................................\n", + "----------------------------------------------------------------------\n", + "Ran 100 tests in 0.139s\n", + "\n", + "OK\n" + ] + } + ], "source": [ "# This will test your function \n", "test_greatest(greatest)" @@ -91,19 +128,34 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "def sum_all(arr):\n", - " pass" + " sum_all = 0\n", + " for x in arr:\n", + " sum_all += x\n", + " return sum_all" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "....................................................................................................\n", + "----------------------------------------------------------------------\n", + "Ran 100 tests in 0.137s\n", + "\n", + "OK\n" + ] + } + ], "source": [ "# This will test your function \n", "test_sum(sum_all)" @@ -118,19 +170,34 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "def mult_all(arr):\n", - " pass" + " multall = 1\n", + " for x in arr:\n", + " multall *= x\n", + " return multall" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "....................................................................................................\n", + "----------------------------------------------------------------------\n", + "Ran 100 tests in 0.121s\n", + "\n", + "OK\n" + ] + } + ], "source": [ "# This will test your function \n", "test_mult(mult_all)" @@ -145,19 +212,36 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "def oper_all(arr, oper):\n", - " pass" + " if oper == \"+\":\n", + " return sum_all(arr)\n", + " elif oper == \"*\":\n", + " return mult_all(arr)\n", + " else:\n", + " return 'err'" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "....................................................................................................\n", + "----------------------------------------------------------------------\n", + "Ran 100 tests in 0.132s\n", + "\n", + "OK\n" + ] + } + ], "source": [ "# This will test your function \n", "test_operations(oper_all)" @@ -172,19 +256,35 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "metadata": {}, "outputs": [], "source": [ "def factorial(n):\n", - " pass" + " final = n\n", + " while n != 1:\n", + " n -=1\n", + " final *= n\n", + " return final" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "....................................................................................................\n", + "----------------------------------------------------------------------\n", + "Ran 100 tests in 0.154s\n", + "\n", + "OK\n" + ] + } + ], "source": [ "# This will test your function \n", "test_factorial(factorial)" @@ -201,19 +301,35 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "metadata": {}, "outputs": [], "source": [ "def unique(arr):\n", - " pass" + " new_arr = []\n", + " for x in arr:\n", + " if x not in new_arr:\n", + " new_arr.append(x)\n", + " return new_arr" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "....................................................................................................\n", + "----------------------------------------------------------------------\n", + "Ran 100 tests in 0.188s\n", + "\n", + "OK\n" + ] + } + ], "source": [ "# This will test your function \n", "test_unique(unique)" @@ -229,19 +345,42 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "metadata": {}, "outputs": [], "source": [ "def mode_counter(arr):\n", - " pass" + " mode = int\n", + " highest_count = 0\n", + " counter = 0\n", + " \n", + " for y in arr:\n", + " for x in arr:\n", + " if y == x:\n", + " counter +=1 # counter++ every time the current number is equal\n", + " if counter > highest_count:\n", + " highest_count = counter\n", + " mode = y\n", + " return mode" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 28, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "....................................................................................................\n", + "----------------------------------------------------------------------\n", + "Ran 100 tests in 0.260s\n", + "\n", + "OK\n" + ] + } + ], "source": [ "# This will test your function \n", "test_mode(mode_counter)" @@ -285,19 +424,352 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 37, "metadata": {}, "outputs": [], "source": [ + "import string\n", + "\n", "def pangram(string):\n", - " pass" + " # loop through all letters in alphabet, exit loop when letter found, move to next letter \n", + " \n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + " for y in string: # check against all letters in string\n", + " if x == y: # when a char matches the current alphabet letter\n", + " break # exit this loop\n", + " return False # otherwise the letter is not found\n", + " return True" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 38, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "======================================================================\n", + "ERROR: runTest (mod.testing.test_pangram..TestKnown)\n", + "----------------------------------------------------------------------\n", + "Traceback (most recent call last):\n", + " File \"/Users/venice/Downloads/1.DS/labs/lab-functions/mod/testing.py\", line 172, in runTest\n", + " self.assertEqual(fn(self.input), self.output, f\"Should be {self.output}\")\n", + " File \"/var/folders/yx/4xsyrpbs305132t_87mnd3600000gn/T/ipykernel_20717/167969502.py\", line 6, in pangram\n", + " for x in range(string.ascii_lowercase[:26]): # loop through all letters of alphabet\n", + "AttributeError: 'str' object has no attribute 'ascii_lowercase'\n", + "\n", + "----------------------------------------------------------------------\n", + "Ran 30 tests in 0.064s\n", + "\n", + "FAILED (errors=30)\n" + ] + } + ], "source": [ "# This will test your function \n", "test_pangram(pangram)" @@ -319,7 +791,8 @@ "outputs": [], "source": [ "def sort_alpha(string):\n", - " pass" + " pass\n", + "# check 16 on today's lesson or study lambda sort functions" ] }, { @@ -363,7 +836,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -377,7 +850,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.6" + "version": "3.9.12" } }, "nbformat": 4,