diff --git a/notebooks/10_Defensive_Programming.ipynb b/notebooks/10_Defensive_Programming.ipynb index 06474db..77e690a 100644 --- a/notebooks/10_Defensive_Programming.ipynb +++ b/notebooks/10_Defensive_Programming.ipynb @@ -537,7 +537,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.10.12" } }, "nbformat": 4, diff --git a/notebooks/11_Debugging.ipynb b/notebooks/11_Debugging.ipynb index 12ee4be..6f0ec4c 100644 --- a/notebooks/11_Debugging.ipynb +++ b/notebooks/11_Debugging.ipynb @@ -223,7 +223,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.10.12" } }, "nbformat": 4, diff --git a/notebooks/1_Python_Fundamentals.ipynb b/notebooks/1_Python_Fundamentals.ipynb index 5a431ba..8585a45 100644 --- a/notebooks/1_Python_Fundamentals.ipynb +++ b/notebooks/1_Python_Fundamentals.ipynb @@ -490,7 +490,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.4" + "version": "3.10.12" } }, "nbformat": 4, diff --git a/notebooks/2_Analysing_Patient_Data.ipynb b/notebooks/2_Analysing_Patient_Data.ipynb index dbf8264..9067d0b 100755 --- a/notebooks/2_Analysing_Patient_Data.ipynb +++ b/notebooks/2_Analysing_Patient_Data.ipynb @@ -828,7 +828,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.4" + "version": "3.10.12" } }, "nbformat": 4, diff --git a/notebooks/3_Visualising_Tabular_Data.ipynb b/notebooks/3_Visualising_Tabular_Data.ipynb index 0b4d37e..5eb14a4 100644 --- a/notebooks/3_Visualising_Tabular_Data.ipynb +++ b/notebooks/3_Visualising_Tabular_Data.ipynb @@ -382,7 +382,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.4" + "version": "3.10.12" } }, "nbformat": 4, diff --git a/notebooks/4_Storing_Multiple_Values_in_Lists.ipynb b/notebooks/4_Storing_Multiple_Values_in_Lists.ipynb index 001de19..218c200 100644 --- a/notebooks/4_Storing_Multiple_Values_in_Lists.ipynb +++ b/notebooks/4_Storing_Multiple_Values_in_Lists.ipynb @@ -60,17 +60,9 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "odds are: [1, 3, 5, 7]\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Example of a List\n", "odds = [1, 3, 5, 7]\n", @@ -86,19 +78,9 @@ }, { "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "first element: 1\n", - "last element: 7\n", - "\"-1\" element: 7\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Printing elements of a list\n", "print(\"first element:\", odds[0])\n", @@ -117,18 +99,9 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "names is originally: ['Curie', 'Darwing', 'Turing']\n", - "final value of names: ['Curie', 'Darwin', 'Turing']\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Modifying elements of a list\n", "names = [\"Curie\", \"Darwing\", \"Turing\"] # typo in Darwin's name\n", @@ -147,21 +120,9 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "ename": "TypeError", - "evalue": "'str' object does not support item assignment", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[4], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# Modifying elements of a string\u001b[39;00m\n\u001b[1;32m 2\u001b[0m name \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mDarwin\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m----> 3\u001b[0m \u001b[43mname\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124md\u001b[39m\u001b[38;5;124m\"\u001b[39m\n", - "\u001b[0;31mTypeError\u001b[0m: 'str' object does not support item assignment" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Modifying elements of a string\n", "name = \"Darwin\"\n", @@ -192,18 +153,9 @@ }, { "cell_type": "code", - "execution_count": 38, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Ingredients in mild salsa: ['hot peppers', 'onions', 'cilantro', 'tomatoes']\n", - "Ingredients in hot salsa: ['hot peppers', 'onions', 'cilantro', 'tomatoes']\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Modifying a referencing of a list\n", "mild_salsa = [\"peppers\", \"onions\", \"cilantro\", \"tomatoes\"]\n", @@ -225,18 +177,9 @@ }, { "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Ingredients in mild salsa: ['peppers', 'onions', 'cilantro', 'tomatoes']\n", - "Ingredients in hot salsa: ['hot peppers', 'onions', 'cilantro', 'tomatoes']\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Modifying a copy of a list\n", "mild_salsa = [\"peppers\", \"onions\", \"cilantro\", \"tomatoes\"]\n", @@ -277,7 +220,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -306,17 +249,9 @@ }, { "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "['lettuce', 'lettuce', 'peppers', 'zucchini']\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Accessing the first element of the list\n", "print(veg[0])" @@ -324,17 +259,9 @@ }, { "cell_type": "code", - "execution_count": 9, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "['lettuce', 'lettuce', 'peppers', 'zucchini']\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Accessing the second element of the list\n", "print(veg[1])" @@ -342,17 +269,9 @@ }, { "cell_type": "code", - "execution_count": 10, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "['lettuce', 'cilantro', 'peppers', 'zucchini']\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Accessing the third element of the list\n", "print(veg[2])" @@ -369,17 +288,9 @@ }, { "cell_type": "code", - "execution_count": 11, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "lettuce\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Accessing the first element of the first nested list\n", "print(veg[0][0])" @@ -387,17 +298,9 @@ }, { "cell_type": "code", - "execution_count": 12, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "peppers\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Accessing the third element of the second nested list\n", "print(veg[1][2])" @@ -416,17 +319,9 @@ }, { "cell_type": "code", - "execution_count": 13, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "odds after adding a value: [1, 3, 5, 7, 11]\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Appending to a list\n", "odds.append(11)\n", @@ -435,18 +330,9 @@ }, { "cell_type": "code", - "execution_count": 14, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "odds after removing the first element: [3, 5, 7, 11]\n", - "removed_element: 1\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Removing elements from a list\n", "removed_element = odds.pop(0)\n", @@ -456,17 +342,9 @@ }, { "cell_type": "code", - "execution_count": 15, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "odds after reversing: [11, 7, 5, 3]\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Reversing a list\n", "odds.reverse()\n", @@ -484,18 +362,9 @@ }, { "cell_type": "code", - "execution_count": 16, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "primes: [3, 5, 7, 2]\n", - "odds: [3, 5, 7, 2]\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Appending to a reference of a list\n", "odds = [3, 5, 7]\n", @@ -515,18 +384,9 @@ }, { "cell_type": "code", - "execution_count": 17, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "primes: [3, 5, 7, 2]\n", - "odds: [3, 5, 7]\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Appending to a copy of a list\n", "odds = [3, 5, 7]\n", @@ -548,7 +408,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -558,17 +418,9 @@ }, { "cell_type": "code", - "execution_count": 19, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "group: Drosophila\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Slicing a string\n", "group = binomial_name[0:10]\n", @@ -577,17 +429,9 @@ }, { "cell_type": "code", - "execution_count": 20, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "species: melanogaster\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Slicing a string cont.\n", "species = binomial_name[11:23]\n", @@ -596,17 +440,9 @@ }, { "cell_type": "code", - "execution_count": 21, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "autosomes: ['2', '3', '4']\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Instantiating and slicing a list\n", "chromosomes = [\"X\", \"Y\", \"2\", \"3\", \"4\"]\n", @@ -616,17 +452,9 @@ }, { "cell_type": "code", - "execution_count": 39, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "last: 4\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Slicing the last element of a list\n", "last = chromosomes[-1]\n", @@ -642,7 +470,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -652,17 +480,9 @@ }, { "cell_type": "code", - "execution_count": 24, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Using 0 to begin range: Monday\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Slicing with a start range index\n", "day = date[0:6]\n", @@ -671,17 +491,9 @@ }, { "cell_type": "code", - "execution_count": 25, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Omitting beginning index: Monday\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Slicing without a start range index\n", "day = date[:6]\n", @@ -697,7 +509,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -720,17 +532,9 @@ }, { "cell_type": "code", - "execution_count": 27, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "With known last position: ['sep', 'oct', 'nov', 'dec']\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Slicing with an end range index\n", "sond = months[8:12]\n", @@ -739,17 +543,9 @@ }, { "cell_type": "code", - "execution_count": 29, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Omitting ending index: ['sep', 'oct', 'nov', 'dec']\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Slicing without an end range index\n", "sond = months[8:]\n", @@ -758,17 +554,9 @@ }, { "cell_type": "code", - "execution_count": 28, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Using len() to get last entry: ['sep', 'oct', 'nov', 'dec']\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Slicing using the len() function\n", "sond = months[8 : len(months)]\n", @@ -789,7 +577,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -805,20 +593,9 @@ }, { "cell_type": "code", - "execution_count": 41, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'2013'" - ] - }, - "execution_count": 41, - "metadata": {}, - "output_type": "execute_result" - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# 1a.\n", "string_for_slicing[-4:]" @@ -826,20 +603,9 @@ }, { "cell_type": "code", - "execution_count": 40, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[['chlorine', 'Cl'], ['bromine', 'Br'], ['iodine', 'I'], ['astatine', 'At']]" - ] - }, - "execution_count": 40, - "metadata": {}, - "output_type": "execute_result" - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# 1b.\n", "list_for_slicing[-4:]" @@ -867,17 +633,9 @@ }, { "cell_type": "code", - "execution_count": 42, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "subset [2, 7, 17, 29]\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]\n", "subset = primes[0:12:3]\n", @@ -893,17 +651,9 @@ }, { "cell_type": "code", - "execution_count": 34, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "subset [5, 13, 23, 37]\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]\n", "subset = primes[2:12:3]\n", @@ -921,7 +671,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -937,20 +687,9 @@ }, { "cell_type": "code", - "execution_count": 43, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'I notpssgre ntesae'" - ] - }, - "execution_count": 43, - "metadata": {}, - "output_type": "execute_result" - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# 1.\n", "beatles[::2]" @@ -973,17 +712,9 @@ }, { "cell_type": "code", - "execution_count": 44, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[2, 4, 6, 8, 10, 2, 4, 6, 8, 10]\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "counts = [2, 4, 6, 8, 10]\n", "repeats = counts * 2\n", @@ -1034,7 +765,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.4" + "version": "3.10.12" } }, "nbformat": 4, diff --git a/notebooks/5_Repeating_Actions_with_Loops.ipynb b/notebooks/5_Repeating_Actions_with_Loops.ipynb index b714c78..9288ee7 100644 --- a/notebooks/5_Repeating_Actions_with_Loops.ipynb +++ b/notebooks/5_Repeating_Actions_with_Loops.ipynb @@ -513,7 +513,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.4" + "version": "3.10.12" } }, "nbformat": 4, diff --git a/notebooks/6_Analysing_Data_from_Multiple_Files.ipynb b/notebooks/6_Analysing_Data_from_Multiple_Files.ipynb index 1aa34b5..6bb634f 100644 --- a/notebooks/6_Analysing_Data_from_Multiple_Files.ipynb +++ b/notebooks/6_Analysing_Data_from_Multiple_Files.ipynb @@ -319,7 +319,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.4" + "version": "3.10.12" } }, "nbformat": 4, diff --git a/notebooks/7_Making_Choices.ipynb b/notebooks/7_Making_Choices.ipynb index c0a6bd5..fdb5b36 100644 --- a/notebooks/7_Making_Choices.ipynb +++ b/notebooks/7_Making_Choices.ipynb @@ -657,7 +657,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.4" + "version": "3.10.12" } }, "nbformat": 4, diff --git a/notebooks/8_Creating_Functions.ipynb b/notebooks/8_Creating_Functions.ipynb index 753362a..d865797 100644 --- a/notebooks/8_Creating_Functions.ipynb +++ b/notebooks/8_Creating_Functions.ipynb @@ -1203,7 +1203,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.4" + "version": "3.10.12" } }, "nbformat": 4, diff --git a/notebooks/9_Errors_and_Exceptions.ipynb b/notebooks/9_Errors_and_Exceptions.ipynb index 6a7a194..a629d62 100644 --- a/notebooks/9_Errors_and_Exceptions.ipynb +++ b/notebooks/9_Errors_and_Exceptions.ipynb @@ -482,7 +482,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.10.12" } }, "nbformat": 4,