From f0722053d47bc24c516f954254facdec6671608a Mon Sep 17 00:00:00 2001 From: smith494 Date: Tue, 19 May 2026 23:17:12 -0500 Subject: [PATCH 1/8] AGENTS.md file has been updated with new requirement --- .opencode/commands/goodnight.md | 20 +++++++++++++++ .opencode/commands/my_model.md | 7 ++++++ AGENTS.md | 43 +++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 .opencode/commands/goodnight.md create mode 100644 .opencode/commands/my_model.md create mode 100644 AGENTS.md diff --git a/.opencode/commands/goodnight.md b/.opencode/commands/goodnight.md new file mode 100644 index 000000000..4bca6d297 --- /dev/null +++ b/.opencode/commands/goodnight.md @@ -0,0 +1,20 @@ +--- +description: Stage all changes, commit, and push to origin +--- + +Run these git commands in order: + +1. `git add .` +2. `git commit -m ""` — see below for how to determine the commit message +3. `git push origin` + +If any command fails, stop and report the error. Do not proceed if the previous step failed. + +**Determine the commit message from $ARGUMENTS:** +- If `$ARGUMENTS` is "UA", use "AGENTS.md file has been updated with new requirement" +- If `$ARGUMENTS` is "CA", use "Codebase has been changed" +- If `$ARGUMENTS` is "PK", use "New package(s) has been added to the project" +- If `$ARGUMENTS` is "DATA", use "New data has been added to the project" +- If `$ARGUMENTS` is "REMOVE", use "Removed package(s) from the project or Codebase has been changed" +- If `$ARGUMENTS` is empty or not provided, use "goodnight commit" +- Otherwise, use `$ARGUMENTS` as the commit message directly diff --git a/.opencode/commands/my_model.md b/.opencode/commands/my_model.md new file mode 100644 index 000000000..f422a8ef1 --- /dev/null +++ b/.opencode/commands/my_model.md @@ -0,0 +1,7 @@ +--- +description: My preferred model +agent: build +model: anthropic/claude-opus-4-6 +--- + +Change the model to my preferred model. \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..18a35af0a --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,43 @@ +# Complete Python 3 Bootcamp + +# CRITICAL RULES - MUST FOLLOW + +## RESPONSES + +- Keep responses concise and to the point - unless the user asks otherwise + +## PLANNING MODE + +- Always ask clarifying questions +- Never assume design, tech stack or features +- Use deep-dive sub-agents to assist with research +- Use deep-dive sub-agents to review the different aspects of your plan before presenting to the user + +## CHANGE / EDIT MODE + +- Never implement features yourself when possible - use sub-agents! +- Identify changes from the plan that can be implemented in parallel, and use sub-agents to implement the features efficiently +- When using sub-agents to implement features, act as a coordinator only +- Use the best model for the task - premium models for complex tasks (like coding) and mid-tier models for simpler tasks, like documentation +- After completing features (large or small), always run commands like lint, type check and next build to check code quality + +**Course companion repo** for the Udemy course by Pierian Data Inc. Not a Python package — purely educational Jupyter Notebooks and supporting scripts. + +## Structure + +- **Sections `00`–`19`**: each is a numbered directory with Jupyter Notebooks (`.ipynb`) as primary content. +- Assessment notebooks follow the pattern `* Assessment Test.ipynb` with a corresponding `* Assessment Test-Solution.ipynb`. +- Supporting `.py` scripts live inside section directories (e.g., `06-Modules and Packages/`, `07-Errors and Exception Handling/`). +- Section `09-Empty-Section-Skip` is **not empty** — it covers Map/Reduce/Filter/etc. + +## Quirks + +- **No `.gitignore`** — `.ipynb_checkpoints` directories **are tracked** in git. Don't add them to `.gitignore` or delete them unless you mean to. +- No build system, no package manager, no CI, no linting/formatter config, no test framework. The only "test" files are `test_cap.py` in section 07 (used for in-notebook demonstrations). +- Notebooks target Python 3 (kernel `python3`). The repo metadata shows Python 3.6.2. + +## Working with the repo + +- No install, setup, or test commands to run. Open any notebook with `jupyter notebook ` or `jupyter lab`. +- `.py` files are standalone scripts that accompany specific notebooks — don't move them between sections. +- Some notebooks reference local files (e.g., `test.txt` in section 00, PDFs in section 15, images in section 14). Keep relative paths intact. From ad995a0e5de2cc189b56f4c963f86d93a05257d5 Mon Sep 17 00:00:00 2001 From: smith494 Date: Mon, 1 Jun 2026 17:58:18 -0500 Subject: [PATCH 2/8] completed Assessment --- ...tatements Assessment Test-checkpoint.ipynb | 243 ++++++++++++++++-- 1 file changed, 217 insertions(+), 26 deletions(-) diff --git a/02-Python Statements/.ipynb_checkpoints/07-Statements Assessment Test-checkpoint.ipynb b/02-Python Statements/.ipynb_checkpoints/07-Statements Assessment Test-checkpoint.ipynb index 26988bd8f..b2c5b60b9 100644 --- a/02-Python Statements/.ipynb_checkpoints/07-Statements Assessment Test-checkpoint.ipynb +++ b/02-Python Statements/.ipynb_checkpoints/07-Statements Assessment Test-checkpoint.ipynb @@ -31,24 +31,37 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": { "collapsed": true }, "outputs": [], "source": [ - "st = 'Print only the words that start with s in this sentence'" + "str = 'Print only the words that start with s in this sentence'" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "['start', 's', 'sentence']" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "#Code here" + "#Code here\n", + "wordwiths = [words for words in str.split() if words[0] == 's' ]\n", + "wordwiths" ] }, { @@ -61,13 +74,28 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n", + "2\n", + "4\n", + "6\n", + "8\n", + "10\n" + ] + } + ], "source": [ - "#Code Here" + "#Code Here\n", + "for num in range(0, 11, 2):\n", + " print(num)" ] }, { @@ -80,14 +108,25 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48]" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "#Code in this cell\n", - "[]" + "[num for num in range(1, 51) if num % 3 == 0]" ] }, { @@ -100,24 +139,46 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": { "collapsed": true }, "outputs": [], "source": [ - "st = 'Print every word in this sentence that has an even number of letters'" + "str = 'Print every word in this sentence that has an even number of letters'" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "word : even!\n", + "in : even!\n", + "this : even!\n", + "sentence : even!\n", + "that : even!\n", + "an : even!\n", + "even : even!\n", + "number : even!\n", + "of : even!\n" + ] + } + ], "source": [ - "#Code in this cell" + "#Code in this cell\n", + "index_count = 0\n", + "listofwords = list(str.split())\n", + "for word in listofwords:\n", + " if(len(word)%2 == 0): \n", + " print(word + ' : even!')\n", + " \n" ] }, { @@ -130,13 +191,130 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1\n", + "2\n", + "Fizz\n", + "4\n", + "Buzz\n", + "Fizz\n", + "7\n", + "8\n", + "Fizz\n", + "Buzz\n", + "11\n", + "Fizz\n", + "13\n", + "14\n", + "FizzBuzz\n", + "16\n", + "17\n", + "Fizz\n", + "19\n", + "Buzz\n", + "Fizz\n", + "22\n", + "23\n", + "Fizz\n", + "Buzz\n", + "26\n", + "Fizz\n", + "28\n", + "29\n", + "FizzBuzz\n", + "31\n", + "32\n", + "Fizz\n", + "34\n", + "Buzz\n", + "Fizz\n", + "37\n", + "38\n", + "Fizz\n", + "Buzz\n", + "41\n", + "Fizz\n", + "43\n", + "44\n", + "FizzBuzz\n", + "46\n", + "47\n", + "Fizz\n", + "49\n", + "Buzz\n", + "Fizz\n", + "52\n", + "53\n", + "Fizz\n", + "Buzz\n", + "56\n", + "Fizz\n", + "58\n", + "59\n", + "FizzBuzz\n", + "61\n", + "62\n", + "Fizz\n", + "64\n", + "Buzz\n", + "Fizz\n", + "67\n", + "68\n", + "Fizz\n", + "Buzz\n", + "71\n", + "Fizz\n", + "73\n", + "74\n", + "FizzBuzz\n", + "76\n", + "77\n", + "Fizz\n", + "79\n", + "Buzz\n", + "Fizz\n", + "82\n", + "83\n", + "Fizz\n", + "Buzz\n", + "86\n", + "Fizz\n", + "88\n", + "89\n", + "FizzBuzz\n", + "91\n", + "92\n", + "Fizz\n", + "94\n", + "Buzz\n", + "Fizz\n", + "97\n", + "98\n", + "Fizz\n", + "Buzz\n" + ] + } + ], "source": [ - "#Code in this cell" + "#Code in this cell\n", + "\n", + "for num in range(1, 101): \n", + " if((num%3 == 0) and (num % 5 == 0)):\n", + " print(\"FizzBuzz\")\n", + " elif(num % 3 == 0):\n", + " print('Fizz')\n", + " elif(num % 5 == 0): \n", + " print('Buzz')\n", + " else:\n", + " print(num)" ] }, { @@ -149,24 +327,37 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "metadata": { "collapsed": true }, "outputs": [], "source": [ - "st = 'Create a list of the first letters of every word in this string'" + "str = 'Create a list of the first letters of every word in this string'" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "['C', 'a', 'l', 'o', 't', 'f', 'l', 'o', 'e', 'w', 'i', 't', 's']" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "#Code in this cell" + "#Code in this cell\n", + "firstletters = [word[0] for word in list(str.split())]\n", + "firstletters" ] }, { @@ -179,7 +370,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": ".venv", "language": "python", "name": "python3" }, @@ -193,7 +384,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.6" + "version": "3.14.5" } }, "nbformat": 4, From 6df2197c4e1d5ebcd94f7bf9cf3c26d9ae1575b9 Mon Sep 17 00:00:00 2001 From: smith494 Date: Fri, 5 Jun 2026 17:04:31 -0500 Subject: [PATCH 3/8] Remvoed the Agent from the code based --- .opencode/commands/goodnight.md | 20 -- .opencode/commands/my_model.md | 7 - .../03-Function Practice Exercises.ipynb | 298 +++++++++++++++--- AGENTS.md | 43 --- 4 files changed, 249 insertions(+), 119 deletions(-) delete mode 100644 .opencode/commands/goodnight.md delete mode 100644 .opencode/commands/my_model.md delete mode 100644 AGENTS.md diff --git a/.opencode/commands/goodnight.md b/.opencode/commands/goodnight.md deleted file mode 100644 index 4bca6d297..000000000 --- a/.opencode/commands/goodnight.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -description: Stage all changes, commit, and push to origin ---- - -Run these git commands in order: - -1. `git add .` -2. `git commit -m ""` — see below for how to determine the commit message -3. `git push origin` - -If any command fails, stop and report the error. Do not proceed if the previous step failed. - -**Determine the commit message from $ARGUMENTS:** -- If `$ARGUMENTS` is "UA", use "AGENTS.md file has been updated with new requirement" -- If `$ARGUMENTS` is "CA", use "Codebase has been changed" -- If `$ARGUMENTS` is "PK", use "New package(s) has been added to the project" -- If `$ARGUMENTS` is "DATA", use "New data has been added to the project" -- If `$ARGUMENTS` is "REMOVE", use "Removed package(s) from the project or Codebase has been changed" -- If `$ARGUMENTS` is empty or not provided, use "goodnight commit" -- Otherwise, use `$ARGUMENTS` as the commit message directly diff --git a/.opencode/commands/my_model.md b/.opencode/commands/my_model.md deleted file mode 100644 index f422a8ef1..000000000 --- a/.opencode/commands/my_model.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -description: My preferred model -agent: build -model: anthropic/claude-opus-4-6 ---- - -Change the model to my preferred model. \ No newline at end of file diff --git a/03-Methods and Functions/03-Function Practice Exercises.ipynb b/03-Methods and Functions/03-Function Practice Exercises.ipynb index e21473093..3593a027c 100644 --- a/03-Methods and Functions/03-Function Practice Exercises.ipynb +++ b/03-Methods and Functions/03-Function Practice Exercises.ipynb @@ -42,23 +42,37 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def lesser_of_two_evens(a,b):\n", - " pass" + " if a % 2 == 0 and b % 2 == 0: \n", + " return min(a,b)\n", + " else: \n", + " return max(a,b)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "2" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "lesser_of_two_evens(2,4)" @@ -66,11 +80,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "5" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "lesser_of_two_evens(2,5)" @@ -87,23 +112,38 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def animal_crackers(text):\n", - " pass" + " words = text.split(' ')\n", + " \n", + " return words[0][0] == words[1][0]\n", + "\n", + " \n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "animal_crackers('Levelheaded Llama')" @@ -111,11 +151,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "animal_crackers('Crazy Kangaroo')" @@ -134,23 +185,37 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def makes_twenty(n1,n2):\n", - " pass" + " if n1 == 20 or n2 == 20:\n", + " return True\n", + " else: \n", + " return (n1 + n2) == 20" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "makes_twenty(20,10)" @@ -158,11 +223,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "makes_twenty(2,3)" @@ -188,23 +264,36 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def old_macdonald(name):\n", - " pass" + " new_name = name[0].upper() + name[1:3] + name[3].upper() + name[4:]\n", + " return new_name\n", + " " ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'MacDonald'" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "old_macdonald('macdonald')" @@ -232,23 +321,36 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 32, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def master_yoda(text):\n", - " pass" + " text = text.split()\n", + " text.reverse()\n", + " return \" \".join(text)\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 33, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'home am I'" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "master_yoda('I am home')" @@ -256,11 +358,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 34, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'ready are We'" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "master_yoda('We are ready')" @@ -282,23 +395,39 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 35, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def almost_there(n):\n", - " pass" + " if(n >= 90 and n <= 110): \n", + " return True\n", + " elif(n >= 190 and n <= 210): \n", + " return True\n", + " else: \n", + " return False" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 36, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "almost_there(104)" @@ -306,11 +435,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 37, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 37, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "almost_there(150)" @@ -318,11 +458,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 38, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "almost_there(209)" @@ -350,23 +501,40 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 46, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def has_33(nums):\n", - " pass" + " counter = 0\n", + " while counter < len(nums)-1:\n", + " if(nums[counter] == 3 and nums[counter+1] == 3):\n", + " return True\n", + " counter += 1\n", + " return False\n", + " " ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 47, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 47, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "has_33([1, 3, 3])" @@ -374,11 +542,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 48, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 48, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "has_33([1, 3, 1, 3])" @@ -386,11 +565,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 49, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 49, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "has_33([3, 1, 3])" @@ -414,16 +604,26 @@ "outputs": [], "source": [ "def paper_doll(text):\n", - " pass" + " text = [ltr * 3 for ltr in text]\n", + " print(t\" \".join[text])\n", + " #return \" \".join[text]" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['HHH', 'eee', 'lll', 'lll', 'ooo']\n" + ] + } + ], "source": [ "# Check\n", "paper_doll('Hello')" @@ -708,7 +908,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": ".venv", "language": "python", "name": "python3" }, @@ -722,7 +922,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.6" + "version": "3.14.5" } }, "nbformat": 4, diff --git a/AGENTS.md b/AGENTS.md deleted file mode 100644 index 18a35af0a..000000000 --- a/AGENTS.md +++ /dev/null @@ -1,43 +0,0 @@ -# Complete Python 3 Bootcamp - -# CRITICAL RULES - MUST FOLLOW - -## RESPONSES - -- Keep responses concise and to the point - unless the user asks otherwise - -## PLANNING MODE - -- Always ask clarifying questions -- Never assume design, tech stack or features -- Use deep-dive sub-agents to assist with research -- Use deep-dive sub-agents to review the different aspects of your plan before presenting to the user - -## CHANGE / EDIT MODE - -- Never implement features yourself when possible - use sub-agents! -- Identify changes from the plan that can be implemented in parallel, and use sub-agents to implement the features efficiently -- When using sub-agents to implement features, act as a coordinator only -- Use the best model for the task - premium models for complex tasks (like coding) and mid-tier models for simpler tasks, like documentation -- After completing features (large or small), always run commands like lint, type check and next build to check code quality - -**Course companion repo** for the Udemy course by Pierian Data Inc. Not a Python package — purely educational Jupyter Notebooks and supporting scripts. - -## Structure - -- **Sections `00`–`19`**: each is a numbered directory with Jupyter Notebooks (`.ipynb`) as primary content. -- Assessment notebooks follow the pattern `* Assessment Test.ipynb` with a corresponding `* Assessment Test-Solution.ipynb`. -- Supporting `.py` scripts live inside section directories (e.g., `06-Modules and Packages/`, `07-Errors and Exception Handling/`). -- Section `09-Empty-Section-Skip` is **not empty** — it covers Map/Reduce/Filter/etc. - -## Quirks - -- **No `.gitignore`** — `.ipynb_checkpoints` directories **are tracked** in git. Don't add them to `.gitignore` or delete them unless you mean to. -- No build system, no package manager, no CI, no linting/formatter config, no test framework. The only "test" files are `test_cap.py` in section 07 (used for in-notebook demonstrations). -- Notebooks target Python 3 (kernel `python3`). The repo metadata shows Python 3.6.2. - -## Working with the repo - -- No install, setup, or test commands to run. Open any notebook with `jupyter notebook ` or `jupyter lab`. -- `.py` files are standalone scripts that accompany specific notebooks — don't move them between sections. -- Some notebooks reference local files (e.g., `test.txt` in section 00, PDFs in section 15, images in section 14). Keep relative paths intact. From a3fb3d74ab74b708a1f0982e3b87f9019d8abc8b Mon Sep 17 00:00:00 2001 From: smith494 Date: Sun, 7 Jun 2026 21:47:57 -0500 Subject: [PATCH 4/8] feat: implement logic for function practice exerci se challenges --- .../03-Function Practice Exercises.ipynb | 273 +++++++++++++++--- 1 file changed, 228 insertions(+), 45 deletions(-) diff --git a/03-Methods and Functions/03-Function Practice Exercises.ipynb b/03-Methods and Functions/03-Function Practice Exercises.ipynb index 3593a027c..aaba45558 100644 --- a/03-Methods and Functions/03-Function Practice Exercises.ipynb +++ b/03-Methods and Functions/03-Function Practice Exercises.ipynb @@ -185,13 +185,14 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def makes_twenty(n1,n2):\n", + " #return (n1 + n2) == 20 or n1 ==20 or n2 == 20\n", " if n1 == 20 or n2 == 20:\n", " return True\n", " else: \n", @@ -395,13 +396,14 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def almost_there(n):\n", + " # return (abs(100 - n) <= 10) or (abs(200 - n) <= 10)\n", " if(n >= 90 and n <= 110): \n", " return True\n", " elif(n >= 190 and n <= 210): \n", @@ -597,7 +599,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": { "collapsed": true }, @@ -605,23 +607,26 @@ "source": [ "def paper_doll(text):\n", " text = [ltr * 3 for ltr in text]\n", - " print(t\" \".join[text])\n", - " #return \" \".join[text]" + " #print(\"\".join(text))\n", + " return \"\".join(text)" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 12, "metadata": { "collapsed": true }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "['HHH', 'eee', 'lll', 'lll', 'ooo']\n" - ] + "data": { + "text/plain": [ + "'HHHeeellllllooo'" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -631,11 +636,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'MMMiiissssssiiissssssiiippppppiii'" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "paper_doll('Mississippi')" @@ -653,23 +669,40 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def blackjack(a,b,c):\n", - " pass" + " card_total = a + b + c \n", + " if card_total <= 21:\n", + " return card_total\n", + " if 11 in (a, b, c): \n", + " card_total -= 10 \n", + " return 'BUST' if card_total > 21 else card_total\n", + " " ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "18" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "blackjack(5,6,7)" @@ -677,11 +710,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'BUST'" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "blackjack(9,9,9)" @@ -689,11 +733,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "19" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "blackjack(9,9,11)" @@ -712,23 +767,40 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def summer_69(arr):\n", - " pass" + " if 6 and 9 in arr:\n", + " pos6 = arr.index(6)\n", + " pos9 = arr.index(9)\n", + " del arr[pos6:pos9+1]\n", + " return sum(arr)\n", + " else:\n", + " return sum(arr)\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "9" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "summer_69([1, 3, 5])" @@ -736,11 +808,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "9" + ] + }, + "execution_count": 28, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "summer_69([4, 5, 6, 7, 8, 9])" @@ -748,11 +831,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "14" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "summer_69([2, 1, 6, 9, 11])" @@ -778,23 +872,42 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 37, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def spy_game(nums):\n", - " pass" + " double_zero_seven = [0,0,7]\n", + " target = 0\n", + " for num in nums: \n", + " if num == double_zero_seven[target]:\n", + " target += 1\n", + " if target == 3: \n", + " return True\n", + " \n", + " return False\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 38, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "spy_game([1,2,4,0,0,7,5])" @@ -802,11 +915,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 39, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "spy_game([1,0,2,4,0,5,7])" @@ -814,11 +938,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 40, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 40, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "spy_game([1,7,2,0,4,5,0])" @@ -836,24 +971,57 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ + "\n", "def count_primes(num):\n", - " pass\n", + " prime_list = [2]\n", + " counter = 3\n", + " if num < 2: \n", + " return 0 \n", + " while counter <=num: \n", + " for check in prime_list:\n", + " if counter % check == 0:\n", + " counter += 2\n", + " break\n", + " else: \n", + " prime_list.append(counter)\n", + " counter +=2\n", + " print(prime_list)\n", + " return len(prime_list)\n", + " \n", " " ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]\n" + ] + }, + { + "data": { + "text/plain": [ + "25" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Check\n", "count_primes(100)" @@ -877,23 +1045,38 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def print_big(letter):\n", - " pass" + " patterns = {1:' * ',2:' * * ',3:'* *',4:'*****',5:'**** ',6:' * ',7:' * ',8:'* * ',9:'* '}\n", + " alphabet = {'A':[1,2,4,3,3],'B':[5,3,5,3,5],'C':[4,9,9,9,4],'D':[5,3,3,3,5],'E':[4,9,4,9,4]}\n", + " for pattern in alphabet[letter.upper()]:\n", + " print(patterns[pattern])\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " * \n", + " * * \n", + "*****\n", + "* *\n", + "* *\n" + ] + } + ], "source": [ "print_big('a')" ] From d2e6329913a658cc175768e23fc3ce08c2eaa5fc Mon Sep 17 00:00:00 2001 From: smith494 Date: Sun, 7 Jun 2026 22:18:21 -0500 Subject: [PATCH 5/8] feat: implement logic for function practice exercise challenges --- 03-Methods and Functions/03-Function Practice Exercises.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/03-Methods and Functions/03-Function Practice Exercises.ipynb b/03-Methods and Functions/03-Function Practice Exercises.ipynb index aaba45558..45214bd78 100644 --- a/03-Methods and Functions/03-Function Practice Exercises.ipynb +++ b/03-Methods and Functions/03-Function Practice Exercises.ipynb @@ -971,7 +971,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": { "collapsed": true }, @@ -988,7 +988,7 @@ " if counter % check == 0:\n", " counter += 2\n", " break\n", - " else: \n", + " else: # for else unique to python as else is lined up with for\n", " prime_list.append(counter)\n", " counter +=2\n", " print(prime_list)\n", From 6855bba0e0ab322c0101b19a8b57d1f02f645add Mon Sep 17 00:00:00 2001 From: smith494 Date: Wed, 10 Jun 2026 00:14:19 -0500 Subject: [PATCH 6/8] completed the functions and method sections --- .../08-Functions and Methods Homework.ipynb | 76 ++++++++++++------- 1 file changed, 50 insertions(+), 26 deletions(-) diff --git a/03-Methods and Functions/08-Functions and Methods Homework.ipynb b/03-Methods and Functions/08-Functions and Methods Homework.ipynb index 70763a3a5..dc41d5d0e 100644 --- a/03-Methods and Functions/08-Functions and Methods Homework.ipynb +++ b/03-Methods and Functions/08-Functions and Methods Homework.ipynb @@ -25,19 +25,19 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def vol(rad):\n", - " pass" + " return ((4/3) * 3.14) * rad**3" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -46,7 +46,7 @@ "33.49333333333333" ] }, - "execution_count": 2, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -66,26 +66,29 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 5, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def ran_check(num,low,high):\n", - " pass" + " if num in range(low, high + 1):\n", + " print(f'{num} is in range between {low} and {high}')\n", + " else: \n", + " print(f'{num} is not in range between {low} and {high}')" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "5 is in the range between 2 and 7\n" + "5 is in range between 2 and 7\n" ] } ], @@ -103,19 +106,19 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 10, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def ran_bool(num,low,high):\n", - " pass" + " return num in range(low, high + 1)" ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -124,7 +127,7 @@ "True" ] }, - "execution_count": 6, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -152,26 +155,32 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ + "from collections import Counter\n", "def up_low(s):\n", - " pass" + " upper_case_count = Counter(char for char in s if char.isupper())\n", + " lower_case_count = Counter(char for char in s if char.islower())\n", + "\n", + " print(f'Original String : {s}')\n", + " print(f'No. of Upper case characters : {sum(upper_case_count.values())}')\n", + " print(f'No. of Lower case Characters : {sum(lower_case_count.values())}')" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Original String : Hello Mr. Rogers, how are you this fine Tuesday?\n", + "Original String : Hello Mr. Rogers, how are you this fine Tuesday?\n", "No. of Upper case characters : 4\n", "No. of Lower case Characters : 33\n" ] @@ -195,28 +204,29 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 14, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def unique_list(lst):\n", - " pass" + " return set(lst)\n", + " " ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[1, 2, 3, 4, 5]" + "{1, 2, 3, 4, 5}" ] }, - "execution_count": 10, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -238,14 +248,28 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "ename": "IndentationError", + "evalue": "unexpected indent (2036241904.py, line 4)", + "output_type": "error", + "traceback": [ + " \u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[17]\u001b[39m\u001b[32m, line 4\u001b[39m\n\u001b[31m \u001b[39m\u001b[31mfor num in numbers_list:\u001b[39m\n ^\n\u001b[31mIndentationError\u001b[39m\u001b[31m:\u001b[39m unexpected indent\n" + ] + } + ], "source": [ "def multiply(numbers): \n", - " pass" + " total_product = 0\n", + "\n", + " for num in numbers: \n", + " total_product *= num\n", + "\n", + "return total_product" ] }, { @@ -395,7 +419,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": ".venv", "language": "python", "name": "python3" }, @@ -409,7 +433,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.6" + "version": "3.14.5" } }, "nbformat": 4, From bf49295b62bbe772a0211f616300cf0955ef8b0c Mon Sep 17 00:00:00 2001 From: smith494 Date: Sun, 21 Jun 2026 23:22:43 -0500 Subject: [PATCH 7/8] Update logic for methods_functions --- .../08-Functions and Methods Homework.ipynb | 59 +++++++++---------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/03-Methods and Functions/08-Functions and Methods Homework.ipynb b/03-Methods and Functions/08-Functions and Methods Homework.ipynb index dc41d5d0e..5e6842689 100644 --- a/03-Methods and Functions/08-Functions and Methods Homework.ipynb +++ b/03-Methods and Functions/08-Functions and Methods Homework.ipynb @@ -204,29 +204,29 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 18, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def unique_list(lst):\n", - " return set(lst)\n", + " return list(set(lst))\n", " " ] }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "{1, 2, 3, 4, 5}" + "[1, 2, 3, 4, 5]" ] }, - "execution_count": 15, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -248,33 +248,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": { "collapsed": true }, - "outputs": [ - { - "ename": "IndentationError", - "evalue": "unexpected indent (2036241904.py, line 4)", - "output_type": "error", - "traceback": [ - " \u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[17]\u001b[39m\u001b[32m, line 4\u001b[39m\n\u001b[31m \u001b[39m\u001b[31mfor num in numbers_list:\u001b[39m\n ^\n\u001b[31mIndentationError\u001b[39m\u001b[31m:\u001b[39m unexpected indent\n" - ] - } - ], + "outputs": [], "source": [ - "def multiply(numbers): \n", - " total_product = 0\n", - "\n", - " for num in numbers: \n", + "def multiply(numbers_list): \n", + " total_product = 1\n", + " for num in numbers_list: \n", " total_product *= num\n", - "\n", - "return total_product" + " return total_product" ] }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -283,7 +272,7 @@ "-24" ] }, - "execution_count": 12, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -304,19 +293,21 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 6, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def palindrome(s):\n", - " pass" + " s = s.replace(\" \", \"\")\n", + " return s == s[::-1]\n", + " " ] }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -325,7 +316,7 @@ "True" ] }, - "execution_count": 14, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -355,7 +346,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 16, "metadata": { "collapsed": true }, @@ -364,12 +355,18 @@ "import string\n", "\n", "def ispangram(str1, alphabet=string.ascii_lowercase):\n", + " str1 = set(str1.lower().replace(\" \", \"\").split())\n", + " alphabet = set(alphabet.split())\n", + "\n", + " return len(str1.intersection(alphabet)) == 0\n", + "\n", + "\n", " pass" ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -378,7 +375,7 @@ "True" ] }, - "execution_count": 16, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } From 8590612293696034fb3728ee3ba399ebf5d6914f Mon Sep 17 00:00:00 2001 From: smith494 Date: Tue, 14 Jul 2026 22:34:04 -0500 Subject: [PATCH 8/8] updated OOP and completed OOP training --- ...oject 1 - Walkthrough Steps Workbook.ipynb | 223 ++++++++++++++---- ...Object Oriented Programming Homework.ipynb | 53 +++-- .../04-OOP Challenge.ipynb | 48 ++-- 3 files changed, 241 insertions(+), 83 deletions(-) diff --git a/04-Milestone Project - 1/02-Milestone Project 1 - Walkthrough Steps Workbook.ipynb b/04-Milestone Project - 1/02-Milestone Project 1 - Walkthrough Steps Workbook.ipynb index 5ecb08f95..9a89b7e64 100644 --- a/04-Milestone Project - 1/02-Milestone Project 1 - Walkthrough Steps Workbook.ipynb +++ b/04-Milestone Project - 1/02-Milestone Project 1 - Walkthrough Steps Workbook.ipynb @@ -54,7 +54,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": { "collapsed": true }, @@ -63,8 +63,12 @@ "from IPython.display import clear_output\n", "\n", "def display_board(board):\n", - " \n", - " pass" + " clear_output()\n", + "\n", + " for i in range(0, 9, 3):\n", + " print(f\"{board[i+1]} | {board[i+2]} | {board[i+3]}\")\n", + " if i < 6:\n", + " print(\"--+---+--\")" ] }, { @@ -76,11 +80,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "X | O | X\n", + "O | X | O\n", + "X | O | X\n" + ] + } + ], "source": [ "test_board = ['#','X','O','X','O','X','O','X','O','X']\n", "display_board(test_board)" @@ -102,8 +116,17 @@ "outputs": [], "source": [ "def player_input():\n", + " player_marker = ''\n", + "\n", + " while player_marker not in ['X', 'O']: \n", + " player_marker = input(\"Player One please enter X or O\").upper()\n", " \n", - " pass" + " if player_marker == 'X':\n", + " return ('X', 'O') \n", + " else: \n", + " return ('O', 'X')\n", + "\n", + " " ] }, { @@ -115,11 +138,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "('X', 'O')" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "player_input()" ] @@ -141,7 +175,10 @@ "source": [ "def place_marker(board, marker, position):\n", " \n", - " pass" + " board[position] = marker\n", + "\n", + "\n", + " #return board" ] }, { @@ -153,11 +190,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "X | O | X\n", + "O | X | O\n", + "X | $ | X\n" + ] + } + ], "source": [ "place_marker(test_board,'$',8)\n", "display_board(test_board)" @@ -172,15 +219,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def win_check(board, mark):\n", - " \n", - " pass" + " wins = [\n", + " [1, 2, 3], [4, 5, 6], [7, 8, 9], #row\n", + " [1, 4, 7], [2, 5, 8], [3, 6, 9], #cols\n", + " [1, 5, 9], [3, 5, 7] #diag \n", + " ]\n", + "\n", + " for combination in wins: \n", + " if all(board[pos] == mark for pos in combination):\n", + " return True\n", + " return False\n", + " " ] }, { @@ -192,11 +248,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "win_check(test_board,'X')" ] @@ -210,16 +277,41 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": { "collapsed": true }, "outputs": [], "source": [ + "from random import randint\n", "import random\n", "\n", "def choose_first():\n", - " pass" + " if randint(1, 2) == 2:\n", + " return \"Player 2\"\n", + " else:\n", + " return \"Player 1\"\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Player 1'" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "choose_first()" ] }, { @@ -231,15 +323,15 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def space_check(board, position):\n", - " \n", - " pass" + " return board[position] == \"\"\n", + " " ] }, { @@ -251,15 +343,15 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def full_board_check(board):\n", - " \n", - " pass" + " return all(board[i] != \"\" for i in range(1, 10))\n", + " " ] }, { @@ -271,15 +363,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "metadata": { "collapsed": true }, "outputs": [], "source": [ - "def player_choice(board):\n", - " \n", - " pass" + "def player_choice(board, player):\n", + " while True:\n", + " try:\n", + " playerchoice = int(input(f\"{player}, Please select your next move by entering a number (1-9): \"))\n", + " except ValueError:\n", + " continue\n", + " if playerchoice in range(1, 10) and space_check(board, playerchoice):\n", + " return playerchoice\n" ] }, { @@ -291,15 +388,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def replay():\n", - " \n", - " pass" + " replay_choice = \"\"\n", + "\n", + " while replay_choice not in [\"Y\", \"N\"]: \n", + " replay_choice = input(\"Would you like to play another game enter Y or N\")\n", + "\n", + " return replay_choice == \"Y\"\n", + "\n" ] }, { @@ -313,28 +415,55 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": { "collapsed": true }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "O | X | X\n", + "O | | \n", + "O | O | X\n", + "Player 2 wins!\n" + ] + } + ], "source": [ "print('Welcome to Tic Tac Toe!')\n", "\n", - "#while True:\n", - " # Set the game up here\n", - " #pass\n", + "while True:\n", + " player_board = ['#', '', '', '', '', '', '', '', '', '']\n", + " player1_marker, player2_marker = player_input()\n", + " turn = choose_first()\n", + " print(f\"{turn} goes first!\")\n", + " game_on = True\n", + "\n", + " while game_on:\n", + " display_board(player_board)\n", + "\n", + " if turn == \"Player 1\":\n", + " position = player_choice(player_board, turn)\n", + " place_marker(player_board, player1_marker, position)\n", + " else:\n", + " position = player_choice(player_board, turn)\n", + " place_marker(player_board, player2_marker, position)\n", + "\n", + " display_board(player_board)\n", "\n", - " #while game_on:\n", - " #Player 1 Turn\n", - " \n", - " \n", - " # Player2's turn.\n", - " \n", - " #pass\n", + " if win_check(player_board, player1_marker if turn == \"Player 1\" else player2_marker):\n", + " print(f\"{turn} wins!\")\n", + " game_on = False\n", + " elif full_board_check(player_board):\n", + " print(\"It's a tie!\")\n", + " game_on = False\n", + " else:\n", + " turn = \"Player 2\" if turn == \"Player 1\" else \"Player 1\"\n", "\n", - " #if not replay():\n", - " #break" + " if not replay():\n", + " break" ] }, { @@ -349,7 +478,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": ".venv", "language": "python", "name": "python3" }, @@ -363,7 +492,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.6" + "version": "3.14.5" } }, "nbformat": 4, diff --git a/05-Object Oriented Programming/02-Object Oriented Programming Homework.ipynb b/05-Object Oriented Programming/02-Object Oriented Programming Homework.ipynb index 7e10ddb75..bf8bf7e07 100644 --- a/05-Object Oriented Programming/02-Object Oriented Programming Homework.ipynb +++ b/05-Object Oriented Programming/02-Object Oriented Programming Homework.ipynb @@ -24,7 +24,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 4, "metadata": { "collapsed": true }, @@ -33,18 +33,28 @@ "class Line:\n", " \n", " def __init__(self,coor1,coor2):\n", - " pass\n", + " self.x1, self.y1 = coor1\n", + " self.x2, self.y2 = coor2 \n", " \n", " def distance(self):\n", - " pass\n", + " x_prime = (self.x2 - self.x1)**2\n", + " y_prime = (self.y2 - self.y1)**2\n", + " distance = (x_prime + y_prime)** .5\n", + "\n", + " return distance\n", " \n", " def slope(self):\n", - " pass" + " x = self.x2 - self.x1\n", + " y = self.y2 - self.y1\n", + "\n", + " m = y/x\n", + "\n", + " return m" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 5, "metadata": { "collapsed": true }, @@ -80,7 +90,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -89,7 +99,7 @@ "1.6" ] }, - "execution_count": 4, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -115,27 +125,34 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 10, "metadata": { "collapsed": true }, "outputs": [], "source": [ "class Cylinder:\n", + "\n", + " pi = 3.14\n", " \n", " def __init__(self,height=1,radius=1):\n", - " pass\n", + " self.height = height\n", + " self.radius = radius\n", " \n", " def volume(self):\n", - " pass\n", + " V = Cylinder.pi * self.radius**2 * self.height\n", + "\n", + " return V\n", " \n", " def surface_area(self):\n", - " pass" + " A = 2 * (Cylinder.pi * self.radius)*(self.radius + self.height)\n", + "\n", + " return A" ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 11, "metadata": { "collapsed": true }, @@ -147,7 +164,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -156,7 +173,7 @@ "56.52" ] }, - "execution_count": 7, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -167,7 +184,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -176,7 +193,7 @@ "94.2" ] }, - "execution_count": 8, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -188,7 +205,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": ".venv", "language": "python", "name": "python3" }, @@ -202,7 +219,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.6" + "version": "3.14.5" } }, "nbformat": 4, diff --git a/05-Object Oriented Programming/04-OOP Challenge.ipynb b/05-Object Oriented Programming/04-OOP Challenge.ipynb index 614576f12..d485376fb 100644 --- a/05-Object Oriented Programming/04-OOP Challenge.ipynb +++ b/05-Object Oriented Programming/04-OOP Challenge.ipynb @@ -41,7 +41,28 @@ "outputs": [], "source": [ "class Account:\n", - " pass" + " owner = \"\"\n", + " balance = 0 \n", + "\n", + " def __init__(self, owner, balance): \n", + " self.owner = owner\n", + " self.balance = balance\n", + "\n", + " def deposit(self, amount):\n", + " if(amount < 0): \n", + " print(\"Amount can not be less then zero\")\n", + " else: \n", + " self.balance += amount\n", + " print(\"Deposit Accepted\")\n", + " \n", + " def withdraw(self, amount):\n", + " if(self.balance < 0 or self.balance < amount):\n", + " print(\"Insufficienct funds are available \")\n", + " else: \n", + " self.balance -= amount\n", + " \n", + " def __str__(self):\n", + " return f\"BankAccount(owner={self.owner}, balance=${self.balance:.2f})\"" ] }, { @@ -65,8 +86,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Account owner: Jose\n", - "Account balance: $100\n" + "BankAccount(owner=Jose, balance=$100.00)\n" ] } ], @@ -98,16 +118,16 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "100" + "75" ] }, - "execution_count": 5, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -139,15 +159,7 @@ "cell_type": "code", "execution_count": 7, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Withdrawal Accepted\n" - ] - } - ], + "outputs": [], "source": [ "acct1.withdraw(75)" ] @@ -161,7 +173,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Funds Unavailable!\n" + "Insufficienct funds are available \n" ] } ], @@ -180,7 +192,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": ".venv", "language": "python", "name": "python3" }, @@ -194,7 +206,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.6" + "version": "3.14.5" } }, "nbformat": 4,