From bf33072dc45103d5a6088efe4c130436d34d189f Mon Sep 17 00:00:00 2001 From: mwill903 Date: Wed, 18 Feb 2026 16:11:05 +0000 Subject: [PATCH] Finished module 1 tasks --- .../Module_1.0_Tutorials_START_HERE.ipynb | 2263 ++++++++++++++--- .../Module_1.1_Practice.ipynb | 1034 ++++++-- .../Module_1.2_Required_Code.ipynb | 50 +- .../p1m1matthewwilliams.ipynb | 67 + .../pythonteachingcode.code-workspace | 7 + Untitled.ipynb | 6 + 6 files changed, 2801 insertions(+), 626 deletions(-) create mode 100644 P1 Python Absolute Beginner/p1m1matthewwilliams.ipynb create mode 100644 P1 Python Absolute Beginner/pythonteachingcode.code-workspace create mode 100644 Untitled.ipynb diff --git a/P1 Python Absolute Beginner/Module_1.0_Tutorials_START_HERE.ipynb b/P1 Python Absolute Beginner/Module_1.0_Tutorials_START_HERE.ipynb index b162afaf..c17e460d 100644 --- a/P1 Python Absolute Beginner/Module_1.0_Tutorials_START_HERE.ipynb +++ b/P1 Python Absolute Beginner/Module_1.0_Tutorials_START_HERE.ipynb @@ -163,14 +163,31 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hello professor dominic!\n" + ] + } + ], + "source": [ + "# this is to say hello\n", + "print(\"hello professor dominic!\")" + ] }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "source": [ "#  \n", " Concepts\n", @@ -237,7 +254,9 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + " " + ] }, { "cell_type": "code", @@ -248,10 +267,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "after edit, save!\n" + ] + } + ], + "source": [ + "print(\"after edit, save!\")" + ] }, { "cell_type": "markdown", @@ -272,15 +301,28 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ctrl s\n" + ] + } + ], + "source": [ + "print(\"ctrl s\")" + ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "# Module 1 Part 2\n", @@ -336,9 +378,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "strings go in single\n", + "or double quotes\n" + ] + } + ], "source": [ "# examples of printing strings with single and double quotes\n", "print('strings go in single')\n", @@ -356,14 +407,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "strings go in single\n", + "or double quotes\n" + ] + } + ], "source": [ "# [ ] enter a string in the print() function using single quotes\n", - "\n", + "print('strings go in single')\n", "# [ ] enter a string in the print() function using double quotes\n", - "\n" + "print(\"or double quotes\")\n" ] }, { @@ -391,9 +451,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "123\n", + "123\n" + ] + } + ], "source": [ "print(123) #integer, with numeric value\n", "print(\"123\") #string, represents text characters" @@ -403,6 +472,9 @@ "cell_type": "markdown", "metadata": { "collapsed": true, + "jupyter": { + "outputs_hidden": true + }, "slideshow": { "slide_type": "slide" } @@ -432,9 +504,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "299\n", + "2017\n" + ] + } + ], "source": [ "# printing an Integer with python\n", "print(299)\n", @@ -454,15 +535,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "100\n", + "100\n" + ] + } + ], "source": [ "# [ ] print an Integer\n", - "\n", + "print(100)\n", "\n", "# [ ] print a strings made of Integer characters\n", - "\n", + "print(\"100\")\n", "\n" ] }, @@ -520,9 +610,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "I am a string\n", + "Run this cell using Ctrl+Enter\n" + ] + } + ], "source": [ "# [ ] Review code and Run\n", "# initialize the variable\n", @@ -537,11 +636,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": { "scrolled": true }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Run this cell using Ctrl+Enter\n" + ] + } + ], "source": [ "# [ ] Review code and Run\n", "# assign a new string to the current_msg\n", @@ -566,12 +673,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Run this cell using Ctrl+Enter\n", + "This is my new string\n" + ] + } + ], "source": [ "# { ] run cell above then run this cell after completing the code as directed\n", - "\n" + "print(current_msg)\n", + "current_msg = \"This is my new string\"\n", + "print(current_msg)" ] }, { @@ -651,9 +769,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "22\n", + "Joana\n" + ] + } + ], "source": [ "test_value = 22\n", "print(test_value)\n", @@ -673,18 +800,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": { "slideshow": { "slide_type": "subslide" } }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Matthew\n" + ] + } + ], "source": [ "# [ ] assign a string value to a variable student_name\n", - "\n", + "student_name = \"Matthew\"\n", "# [ ] print the value of variable student_name\n", - "\n" + "print(student_name)\n" ] }, { @@ -699,18 +834,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Josh\n", + "Seth\n" + ] + } + ], "source": [ "# [ ] assign the student_name variable a different string value (a different name)\n", - "\n", + "student_name = \"Josh\"\n", "# [ ] print the value of variable student_name\n", - "\n", + "print(student_name)\n", "# [ ] assign a 3rd different string value, to the variable name \n", - "\n", + "student_name = \"Seth\"\n", "# [ ] print the value of variable name\n", - "\n" + "print(student_name)\n" ] }, { @@ -726,18 +870,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "String\n", + "15\n" + ] + } + ], "source": [ "# [ ] assigning a value to a variable called bucket\n", - "\n", + "bucket = \"String\"\n", "# [ ] print the value of bucket \n", - "\n", + "print(bucket)\n", "# [ ] assign an Integer value (no quotes) to the variable bucket\n", - "\n", + "bucket = 15\n", "# [ ] print the value of bucket \n", - "\n", + "print(bucket)\n", "\n" ] }, @@ -800,9 +953,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "str" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] Read and run the code\n", "type(\"Hello World!\")" @@ -810,27 +974,60 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "int" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "type(501)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "float" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "type(8.33333)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "str" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "student_name = \"Colette Browning\"\n", "type(student_name)" @@ -848,105 +1045,217 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "int" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] show the type after assigning bucket = a whole number value such as 16 \n", - "\n", + "bucket = 16\n", + "type(bucket)\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "str" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] show the type after assigning bucket = a word in \"double quotes\"\n", - "\n", + "bucket = \"Kitty\"\n", + "type(bucket)\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "str" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] display the type of 'single quoting' (use single quotes) \n", - "\n", + "type('kitty')\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "str" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] display the type of \"double quoting\" (use double quotes)\n", - "\n" + "type(\"kitty\")\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "str" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] display the type of \"12\" (use quotes)\n", - "\n" + "type(\"12\")\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "int" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] display the type of 12 (no quotes)\n", - "\n" + "type(12)\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "int" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] display the type of -12 (no quotes)\n", - "\n" + "type(-12)\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "float" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] display the type of 12.0 (no quotes)\n", - "\n" + "type(12.0)\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "float" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] display the type of 1.55\n", - "\n" + "type(1.55)\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "type" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] find the type of the type(3) statement (no quotes) - just for fun\n", - "\n" + "type(type(3))\n" ] }, { @@ -1017,9 +1326,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "41" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] Review and run code for adding a pair of 2 digit Integers\n", "23 + 18" @@ -1027,9 +1347,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'my name is Alyssa'" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] Review and run code for adding 2 strings\n", "\"my name is \" + \"Alyssa\" " @@ -1037,9 +1368,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'my shoe color is brown'" + ] + }, + "execution_count": 28, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] Review and run code for adding a variable string and a literal string\n", "shoe_color = \"brown\"\n", @@ -1057,52 +1399,110 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "154" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] add 3 integer numbers\n", - "\n" + "20 + 67 + 67\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "79.0" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] add a float number and an integer number\n", - "\n" + "12.0 + 67\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 31, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'This notebook belongs to Matt.'" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] Add the string \"This notebook belongs to \" and a string with your first name\n", - "\n" + "\"This notebook belongs to \" + \"Matt.\"\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 32, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "73" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] Create variables sm_number and big_number and assign numbers then add the numbers\n", - "\n" + "sm_number = 6\n", + "big_number = 67\n", + "sm_number + big_number\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 33, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'Matt, remember to save the notebook frequently'" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] assign a string value to the variable first_name and add to the string \", remember to save the notebook frequently\"\n", - "\n" + "first_name = \"Matt\"\n", + "first_name + \", remember to save the notebook frequently\"\n" ] }, { @@ -1129,9 +1529,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 34, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "50\n", + "Happy Birthday Alton\n" + ] + } + ], "source": [ "# [ ] review & run code for assigning variables & using addition\n", "add_two = 34 + 16\n", @@ -1144,9 +1553,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 35, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "13\n", + "26\n", + "\n" + ] + } + ], "source": [ "# [ ] review & run code for Integer addition in variables and in a print function\n", "int_sum = 6 + 7\n", @@ -1157,9 +1576,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 36, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "I do not wear a hat\n", + "at dinner\n" + ] + } + ], "source": [ "# string addition in variables and in print()function\n", "hat_msg = \"I do not wear \" + \"a hat\" \n", @@ -1178,37 +1606,62 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "My favorite food is pizza\n" + ] + } + ], "source": [ "# [ ] perform string addition in the variable named new_msg (add a string to \"my favorite food is \")\n", "new_msg = \"My favorite food is\"\n", - "print(new_msg)\n", + "print(new_msg + \" pizza\")\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "69\n" + ] + } + ], "source": [ "# [ ] perform Integer addition in the variable named new_sum (add 2 or more Integers)\n", "new_sum = 0\n", - "print(new_sum)\n", + "print(new_sum + 2 + 67)\n", "\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "My favorite food is pizza\n" + ] + } + ], "source": [ "# [ ] create and print a new string variable, new_msg_2, that concatenates new_msg + a literal string\n", - "\n" + "new_msg_2 = new_msg + \" pizza\"\n", + "print(new_msg_2)\n" ] }, { @@ -1269,33 +1722,60 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "48\n" + ] + } + ], "source": [ "# [ ] review and run the code - then fix any Errors\n", - "total_cost = 3 + \"45\"\n", + "total_cost = 3 + 45\n", "print(total_cost)\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the street number of Central School is 123\n" + ] + } + ], "source": [ "# [ ] review and run the code - then fix any Errors\n", - "school_num = 123\n", + "school_num = \"123\"\n", "print(\"the street number of Central School is \" + school_num)\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "\n", + "6.3\n", + "this is a float\n" + ] + } + ], "source": [ "# [ ] Read and run the code - write a hypothesis for what you observe adding float + int\n", "# [ ] HYPOTHESIS: \n", @@ -1303,7 +1783,7 @@ "print(type(3.3))\n", "print(type(3))\n", "print(3.3 + 3)\n", - "\n" + "print(\"this is a float\")\n" ] }, { @@ -1337,14 +1817,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hi!\n", + "I like the morning\n" + ] + } + ], "source": [ "# [ ] review and run the code for properly and improperly formatted print statement\n", "print(\"Hi!\")\n", "## Improper format - non matching quotes\n", - "print('I like the morning\") " + "print(\"I like the morning\") " ] }, { @@ -1356,12 +1845,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hi\n" + ] + } + ], "source": [ "# [ ] review and run the code \n", - "prin('hi')" + "print('hi')" ] }, { @@ -1374,12 +1871,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "where are my socks?\n" + ] + } + ], "source": [ "# [ ] review and run the code missing the closing parenthesis \n", - "print(\"where are my socks?\" " + "print(\"where are my socks?\")" ] }, { @@ -1391,12 +1896,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "my socks are in the wrong bin\n" + ] + } + ], "source": [ "# { ] review and run the code \n", - "print(\"my socks are in the wrong bin)\" " + "print(\"my socks are in the wrong bin\")" ] }, { @@ -1417,57 +1930,97 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "my socks do not match\n" + ] + } + ], "source": [ "# [ ] repair the syntax error \n", - "print('my socks do not match\") \n", + "print('my socks do not match') \n", " \n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "my socks match now\n" + ] + } + ], "source": [ "# [ ] repair the NameError \n", - "pront(\"my socks match now\") \n", + "print(\"my socks match now\") \n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Save the notebook frequently\n" + ] + } + ], "source": [ "# [ ] repair the syntax error \n", - "print\"Save the notebook frequently\")\n", + "print(\"Save the notebook frequently\")\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Alton\n" + ] + } + ], "source": [ "# [ ] repair the NameError \n", "student_name = \"Alton\"\n", - "print(STUDENT_NAME)\n", + "print(student_name)\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3 students are signed up for tutoring\n" + ] + } + ], "source": [ "# [ ] repair the TypeError\n", - "total = 3\n", + "total = \"3\"\n", "print(total + \" students are signed up for tutoring\")\n", "\n" ] @@ -1522,9 +2075,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " *\n", + " * *\n", + " *****\n", + " * *\n", + "* *\n", + "\n" + ] + } + ], "source": [ "# the letter 'A'\n", "print(\" *\")\n", @@ -1554,12 +2120,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "_ _\n", + " / /\n", + " / . . /\n", + " V\n" + ] + } + ], "source": [ "# create # [ ] flying bird character art \n", - "\n" + "print(\"_ _\") \n", + "print(\" / /\") \n", + "print(\" / . . /\") \n", + "print(\" V\") \n" ] }, { @@ -1572,15 +2152,36 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "*****\n", + "*\n", + "*****\n", + "*\n", + "*****\n" + ] + } + ], + "source": [ + "print(\"*****\")\n", + "print(\"*\")\n", + "print(\"*****\")\n", + "print(\"*\")\n", + "print(\"*****\")" + ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "# Module 1 Part 6\n", @@ -1606,7 +2207,10 @@ { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "#   \n", @@ -1629,9 +2233,32 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "enter a small int: \n" + ] + }, + { + "name": "stdin", + "output_type": "stream", + "text": [ + " 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "small int: \n", + "4\n" + ] + } + ], "source": [ "# review and run code - enter a small integer in the text box\n", "print(\"enter a small int: \")\n", @@ -1655,14 +2282,29 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Please give me a student name: Matt\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Student name type is + type(student_name))\n" + ] + } + ], "source": [ "# [ ] get input for the variable student_name\n", - "\n", + "student_name = input(\"Please give me a student name: \")\n", "# [ ] determine the type of student_name\n", - "\n", + "print(\"Student name type is + type(student_name))\")\n", "\n" ] }, @@ -1683,9 +2325,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "enter a name or number\n" + ] + }, + { + "name": "stdin", + "output_type": "stream", + "text": [ + " Matt\n" + ] + } + ], "source": [ "# [ ] run cell several times entering a name a int number and a float number after adding code below\n", "print(\"enter a name or number\")\n", @@ -1717,9 +2374,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "enter the student name: Matt\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hi Matt\n" + ] + } + ], "source": [ "student_name = input(\"enter the student name: \") \n", "print(\"Hi \" + student_name)" @@ -1738,22 +2410,40 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "enter the city name: Kennesaw\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Kennesaw\n" + ] + } + ], "source": [ "# [ ] get user input for a city name in the variable named city\n", - "\n", + "city_name = input(\"enter the city name: \")\n", "# [ ] print the city name\n", - "\n", + "print(city_name)\n", "\n" ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true - }, + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } + }, "source": [ "\n", " Task cont... \n", @@ -1773,16 +2463,39 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Please enter a name: Matt\n", + "Please enter an age: 20\n", + "Want email promotions? (Yes or No) Yes\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Name: Matt\n", + "Age: 20\n", + "Do you want email promotions? Yes\n" + ] + } + ], "source": [ "# [ ]create variables to store input: name, age, get_mail with prompts\n", "# for name, age and yes/no to being on an email list\n", - "\n", + "name = input(\"Please enter a name: \")\n", + "age = input(\"Please enter an age: \")\n", + "get_mail = input(\"Want email promotions? (Yes or No)\")\n", "\n", "# [ ] print a description + variable value for each variable\n", - "\n", + "print(\"Name: \" + name)\n", + "print(\"Age: \" + age)\n", + "print(\"Do you want email promotions? \" + get_mail)\n", "\n" ] }, @@ -1854,9 +2567,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "41" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] Review and run code for adding a pair of 2 digit Integers\n", "23 + 18" @@ -1864,9 +2588,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'my name is Alyssa'" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] Review and run code for adding 2 strings\n", "\"my name is \" + \"Alyssa\" " @@ -1874,9 +2609,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'my shoe color is brown'" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] Review and run code for adding a variable string and a literal string\n", "shoe_color = \"brown\"\n", @@ -1894,48 +2640,97 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "134" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] add 3 integer numbers\n", - "\n" + "67 + 67\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "134.0" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] add a float number and an integer number\n", - "\n" + "67.0 + 67\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'This notebook belongs to Matt.'" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] Add the string \"This notebook belongs to \" and a string with your first name\n", - "\n" + "\"This notebook belongs to \" + \"Matt.\"\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "1134" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] Create variables sm_number and big_number and assign numbers then add the numbers\n", - "\n" + "sm_number = 67\n", + "big_number = 1067\n", + "sm_number + big_number\n" ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "# Module 1 Part 8\n", @@ -1961,7 +2756,10 @@ { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "#  \n", @@ -1986,9 +2784,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello Collette!\n", + "Hello to Collette who is from the city\n" + ] + } + ], "source": [ "# review and run code\n", "\n", @@ -2012,12 +2819,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello Matt the goat!\n" + ] + } + ], "source": [ "# [ ] print 3 strings on the same line using commas inside the print() function \n", - "\n" + "name = \"Matt\"\n", + "print(\"Hello\",name,\"the goat!\")\n" ] }, { @@ -2044,9 +2860,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "I will pick you up @ 6 for the party\n" + ] + } + ], "source": [ "# review and run code\n", "print(\"I will pick you up @\",6,\"for the party\")" @@ -2054,9 +2878,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "An Integer of 14 combined with strings causes 0 TypeErrors in comma formatted print!\n" + ] + } + ], "source": [ "# review and run code\n", "number_errors = 0\n", @@ -2074,18 +2906,29 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The number 67 was very popular in 2025\n" + ] + } + ], "source": [ "# [ ] use a print() function with comma separation to combine 2 numbers and 2 strings\n", - "\n" + "print(\"The number\",67,\"was very popular in\",2025)\n" ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ " Task 17 \n", @@ -2101,15 +2944,32 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Street Name: Kennesaw Ave\n", + "Street Number: 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Address: 10 Kennesaw Ave\n" + ] + } + ], "source": [ "# [ ] get user input for a street name in the variable, street\n", - "\n", + "street = input(\"Street Name: \")\n", "# [ ] get user input for a street number in the variable, st_number\n", - "\n", + "st_number = input(\"Street Number: \")\n", "# [ ] display a message about the street and st_number\n", + "print(\"Address: \",st_number,street)\n", "\n", "\n" ] @@ -2125,21 +2985,32 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Matt is the number 1 player in the country.\n" + ] + } + ], "source": [ "# [ ] define a variable with a string or numeric value\n", - "\n", + "name = \"Matt\"\n", "# [ ] display a message combining the variable, 1 or more literal strings and a number\n", - "\n", + "print(name,\"is the number\",1,\"player in the country.\")\n", "\n" ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ " Task 19 \n", @@ -2169,34 +3040,66 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Please enter the name of the owner of this reservation: Matt\n", + "Please enter the number of people attending: 10\n", + "Please enter the class time you want to reserve: 4:00PM\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reminder: Training is scheduled at 4:00PM for the Matt group of 10 attendees.\n", + "Please arrive 5 minutes early for the first class.\n" + ] + } + ], "source": [ "# [ ] get input for variables: owner, num_people, training_time - use descriptive prompt text\n", - "owner = \n", - "num_people = \n", - "training_time = \n", + "owner = input(\"Please enter the name of the owner of this reservation: \")\n", + "num_people = input(\"Please enter the number of people attending: \")\n", + "training_time = input(\"Please enter the class time you want to reserve: \")\n", "# [ ] create a integer variable min_early and \"hard code\" the integer value (e.g. - 5, 10 or 15)\n", - "min_early = \n", + "min_early = 5\n", "# [ ] print reminder text using all variables & add additional strings - use comma separated print formatting\n", - "\n", + "print(\"Reminder: Training is scheduled at\",training_time,\"for the\",owner,\"group of\",num_people,\"attendees.\")\n", + "print(\"Please arrive\",min_early,\"minutes early for the first class.\")\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Matt, remember to save the notebook frequently.\n" + ] + } + ], "source": [ - "# [ ] assign a string value to the variable first_name and add to the string \", remember to save the notebook frequently\"\n" + "# [ ] assign a string value to the variable first_name and add to the string \", remember to save the notebook frequently\"\n", + "first_name = \"Matt\"\n", + "print(first_name + \", remember to save the notebook frequently.\")" ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "# Module 1 Part 9 - Same items as M1 P8 but iterate, change them\n", @@ -2222,7 +3125,10 @@ { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "#  \n", @@ -2274,12 +3180,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello Matt the worker!\n" + ] + } + ], "source": [ "# [ ] print 3 strings on the same line using commas inside the print() function \n", - "\n" + "name = \"Matt\"\n", + "print(\"Hello\",name,\"the worker!\")\n" ] }, { @@ -2306,9 +3221,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "I will pick you up @ 6 for the party\n" + ] + } + ], "source": [ "# review and run code\n", "print(\"I will pick you up @\",6,\"for the party\")" @@ -2316,9 +3239,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "An Integer of 14 combined with strings causes 0 TypeErrors in comma formatted print!\n" + ] + } + ], "source": [ "# review and run code\n", "number_errors = 0\n", @@ -2336,18 +3267,29 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "An integer of 21 combined with 7 equals 28\n" + ] + } + ], "source": [ "# [ ] use a print() function with comma separation to combine 2 numbers and 2 strings\n", - "\n" + "print(\"An integer of\",21,\"combined with\",7,\"equals\",28)\n" ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ " Task 22 \n", @@ -2363,16 +3305,32 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Please enter your street name: Collins Place\n", + "Please enter your street number: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Address: 5 Collins Place\n" + ] + } + ], "source": [ "# [ ] get user input for a street name in the variable, street\n", - "\n", + "street = input(\"Please enter your street name: \")\n", "# [ ] get user input for a street number in the variable, st_number\n", - "\n", + "st_number = input(\"Please enter your street number: \")\n", "# [ ] display a message about the street and st_number\n", - "\n", + "print(\"Address:\",st_number,street)\n", "\n" ] }, @@ -2387,21 +3345,32 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "I am Matt and I am 20\n" + ] + } + ], "source": [ "# [ ] define a variable with a string or numeric value\n", - "\n", + "name = \"Matt\"\n", "# [ ] display a message combining the variable, 1 or more literal strings and a number\n", - "\n", + "print(\"I am\",name,\"and I am\",20)\n", "\n" ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ " Task 24 \n", @@ -2431,25 +3400,47 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "enter name for contact person for training group: Matt & Josh\n", + "enter the total number attending the course: 2\n", + "enter the training time selected: 4:00PM\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reminder: training is scheduled at 4:00PM for the Matt & Josh group of 2 attendees.\n", + "Please arrive 10 minutes early for the first class.\n" + ] + } + ], "source": [ "# [ ] get input for variables: owner, num_people, training_time - use descriptive prompt text\n", - "owner = \n", - "num_people = \n", - "training_time = \n", + "owner = input(\"enter name for contact person for training group: \")\n", + "num_people = input(\"enter the total number attending the course: \")\n", + "training_time = input(\"enter the training time selected: \")\n", "# [ ] create a integer variable min_early and \"hard code\" the integer value (e.g. - 5, 10 or 15)\n", - "min_early = \n", + "min_early = 10\n", "# [ ] print reminder text using all variables & add additional strings - use comma separated print formatting\n", - "\n", + "print(\"Reminder: training is scheduled at\",training_time,\"for the\",owner,\"group of\",num_people,\"attendees.\")\n", + "print(\"Please arrive\",min_early,\"minutes early for the first class.\")\n", "\n" ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "# Module 1 Part 10\n", @@ -2475,7 +3466,10 @@ { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "#  \n", @@ -2497,9 +3491,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "It's time to save your code\n", + "I said to the class \"sometimes you need to shut down and restart a notebook when cells refuse to run\"\n" + ] + } + ], "source": [ "# review and run the code\n", "\n", @@ -2521,28 +3524,48 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Where's the homework?\n" + ] + } + ], "source": [ "# [ ] using a print statement, display the text: Where's the homework?\n", - "\n" + "print(\"Where's the homework?\")\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Education is what remains after one has forgotten what one has learned in school - Albert Einstein\n" + ] + } + ], "source": [ "# [ ] output with double quotes: \"Education is what remains after one has forgotten what one has learned in school\" - Albert Einstein\n", - "\n" + "albert = \"Education is what remains after one has forgotten what one has learned in school\"\n", + "print(albert,\"- Albert Einstein\")\n" ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ ">**note:**: Quotes in quotes handles only simple cases of displaying quotation marks. More complex case are covered later under *escape sequences.*" @@ -2551,7 +3574,10 @@ { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "#  \n", @@ -2587,45 +3613,97 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "\"Python\".isalpha()" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "\"3rd\".isalnum()" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "\"A Cold Stromy Night\".istitle()" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "\"1003\".isdigit()" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "cm height: 176 is all digits = True\n" + ] + } + ], "source": [ "cm_height = \"176\"\n", "print(\"cm height:\",cm_height, \"is all digits =\",cm_height.isdigit())" @@ -2633,9 +3711,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "False\n", + "True\n" + ] + } + ], "source": [ "print(\"SAVE\".islower())\n", "print(\"SAVE\".isupper())" @@ -2643,9 +3730,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "\"Boolean\".startswith(\"B\")" ] @@ -2661,28 +3759,53 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] Use .isalpha() on the string \"alphabetical\"\n", - "\n" + "\"alphabetical\".isalpha()\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] Use .isalpha() on the string: \"Are spaces and punctuation Alphabetical?\"\n", - "\n" + "\"Are spaces and punctuation Alphabetical?\".isalpha()\n" ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "# Module 1 Part 11 - Same items as M1 P10, iterate, try something new\n", @@ -2708,7 +3831,10 @@ { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "#  \n", @@ -2730,9 +3856,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "It's time to save your code\n", + "I said to the class \"sometimes you need to shut down and restart a notebook when cells refuse to run\"\n" + ] + } + ], "source": [ "# review and run the code\n", "\n", @@ -2754,28 +3889,48 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Where's the homework\n" + ] + } + ], "source": [ "# [ ] using a print statement, display the text: Where's the homework?\n", - "\n" + "print(\"Where's the homework\")\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Education is what remains after one has forgotten what one has learned in school - Albert Einstein\n" + ] + } + ], "source": [ "# [ ] output with double quotes: \"Education is what remains after one has forgotten what one has learned in school\" - Albert Einstein\n", - "\n" + "albert = \"Education is what remains after one has forgotten what one has learned in school\"\n", + "print(albert,\"- Albert Einstein\")\n" ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ ">**note:**: Quotes in quotes handles only simple cases of displaying quotation marks. More complex case are covered later under *escape sequences.*" @@ -2784,7 +3939,10 @@ { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "#  \n", @@ -2821,45 +3979,97 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 28, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "\"Python\".isalpha()" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "\"3rd\".isalnum()" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "\"A Cold Stromy Night\".istitle()" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 31, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "\"1003\".isdigit()" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 32, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "cm height: 176 is all digits = True\n" + ] + } + ], "source": [ "cm_height = \"176\"\n", "print(\"cm height:\",cm_height, \"is all digits =\",cm_height.isdigit())" @@ -2867,9 +4077,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 33, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "False\n", + "True\n" + ] + } + ], "source": [ "print(\"SAVE\".islower())\n", "print(\"SAVE\".isupper())" @@ -2877,9 +4096,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 34, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "\"Boolean\".startswith(\"B\")" ] @@ -2895,40 +4125,76 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 35, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] Use .isalpha() on the string \"alphabetical\"\n", - "\n" + "\"alphabetical\".isalpha()\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 36, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] Use .isalpha() on the string: \"Are spaces and punctuation Alphabetical?\"\n", - "\n" + "\"Are spaces and punctuation Alphabetical?\".isalpha()\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 37, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 37, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] initailize variable alpha_test with input\n", - "\n", + "alpha_test = \"Alphabetical\"\n", "# [ ] use .isalpha() on string variable alpha_test\n", - "\n" + "alpha_test.isalpha()\n" ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "# Module 1 Part 12\n", @@ -2954,7 +4220,10 @@ { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "#  \n", @@ -2979,18 +4248,34 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 38, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Ms. browning is in her office.\n" + ] + } + ], "source": [ "print(\"ms. Browning is in her office.\".capitalize())" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 39, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Green green green and GREEN!\n" + ] + } + ], "source": [ "fav_color = \"green\"\n", "print(fav_color.capitalize(), fav_color, fav_color,\"and\", fav_color.upper()+\"!\")" @@ -3008,42 +4293,64 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 42, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "PIZZA is the best!\n", + "pizza is the best!\n", + "PIzZA is the best!\n", + "Pizza is the best!\n" + ] + } + ], "source": [ "# [ ] get input for a variable, fav_food, that describes a favorite food\n", - "\n", + "fav_food = \"piZza\"\n", "# [ ] display fav_food as ALL CAPS, used in a sentence\n", - "\n", + "print(fav_food.upper(),\"is the best!\")\n", "\n", "# [ ] dispaly fav_food as all lower case, used in a sentence\n", - "\n", + "print(fav_food.lower(),\"is the best!\")\n", "\n", "# [] display fav_food with swapped case, used in a sentence\n", - "\n", + "print(fav_food.swapcase(),\"is the best!\")\n", "\n", "# [] display fav_food with capitalization, used in a sentence\n", - "\n", + "print(fav_food.capitalize(),\"is the best!\")\n", "\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 44, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Forest green forest green FOREST GREEN is awesome. fOREST gREEN\n" + ] + } + ], "source": [ "fav_color = \"Forest Green\"\n", "# [] display the fav_color variable as upper, lower, swapcase, and capitalize formatting in a single print() statement\n", - "\n" + "print(fav_color.capitalize(),fav_color.lower(),fav_color.upper(),\"is awesome.\",fav_color.swapcase())\n" ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "#  \n", @@ -3056,7 +4363,10 @@ { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ " Example" @@ -3064,9 +4374,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "What is your favorite color?: green\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "green\n" + ] + } + ], "source": [ "# review and run code - test a capitalized color input\n", "fav_color = input('What is your favorite color?: ').lower()\n", @@ -3084,9 +4409,32 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "BLUE reversed\n", + "NBLAH blahblah\n" + ] + }, + { + "name": "stdin", + "output_type": "stream", + "text": [ + "What is your favorite color?: green\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Your favorite color in all caps is: GREEN\n" + ] + } + ], "source": [ "def short_rhyme(r1,r2):\n", " print(r1.upper(),r2.lower())\n", @@ -3097,13 +4445,20 @@ "r1 = \"nblah\"\n", "r2 = \"blahblah\"\n", "short_rhyme(rh1,rh2)\n", - "short_rhyme(r1,r2)" + "short_rhyme(r1,r2)\n", + "# [ ] format input() with .upper()\n", + "fav_color = input(\"What is your favorite color?: \").upper()\n", + "\n", + "print(\"Your favorite color in all caps is:\", fav_color)" ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "#  \n", @@ -3123,11 +4478,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": { "scrolled": true }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "True\n" + ] + } + ], "source": [ "# review and run code to test if a string is to be found in another string\n", "menu = \"salad, pasta, sandwich, pizza, drinks, dessert\"\n", @@ -3136,9 +4499,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "'hello' in greeting = False\n", + "'Hello' in greeting = True\n" + ] + } + ], "source": [ "# review and run code to test case sensitive examples \n", "greeting = \"Hello World!\"\n", @@ -3155,9 +4527,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "'hello' in greeting = False\n", + "'Hello' in greeting = True\n", + "'hello' in greeting if lower used = True\n" + ] + } + ], "source": [ "# review and run code to test removing case sensitivity from a string comparison\n", "greeting = \"Hello World!\"\n", @@ -3179,16 +4561,25 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Pizza in menu = True\n", + "Soup in menu = False\n", + "Dessert in menu = True\n" + ] + } + ], "source": [ "# [] print 3 tests, with description text, testing the menu variable for 'pizza', 'soup' and 'dessert'\n", "menu = \"salad, pasta, sandwich, pizza, drinks, dessert\"\n", - "\n", - "result = input(\"What is your name? \")\n", - "\n", - "print(\"Your name is\",result.upper())\n" + "print(\"Pizza in menu =\", \"pizza\" in menu)\n", + "print(\"Soup in menu =\", \"soup\" in menu)\n", + "print(\"Dessert in menu =\", \"dessert\" in menu)\n" ] }, { @@ -3204,12 +4595,33 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "What item would you like to check? pizza\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Is pizza on the menu? True\n" + ] + } + ], "source": [ "# Create a program where the user supplies input to search the menu\n", + "menu = \"salad, pasta, sandwich, pizza, drinks, dessert\"\n", + "\n", + "menu_ask = input(\"What item would you like to check? \").lower()\n", "\n", + "is_on_menu = menu_ask in menu.lower()\n", + "\n", + "print(\"Is\", menu_ask, \"on the menu?\", is_on_menu)\n", "\n" ] }, @@ -3229,22 +4641,63 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Our menu includes: salad, pasta, sandwich, pizza, drinks, dessert\n" + ] + }, + { + "name": "stdin", + "output_type": "stream", + "text": [ + "What item would you like to add? eggs\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Updated menu: salad, pasta, sandwich, pizza, drinks, dessert, eggs\n" + ] + } + ], "source": [ "# add to menu\n", - "\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "print(\"Our menu includes:\",menu)\n", + "add_item = input(\"What item would you like to add?\")\n", + "new_menu = menu + \",\" + \" \" + add_item\n", + "print(\"Updated menu:\",new_menu)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Enter an item to search for: eggs\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Is eggs available? True\n" + ] + } + ], "source": [ "# Testing Add to Menu - create user input to search for an item on the new menu\n", - "\n" + "search_item = input(\"Enter an item to search for: \").lower()\n", + "print(\"Is\", search_item, \"available?\", search_item in new_menu.lower())\n" ] }, { @@ -3258,13 +4711,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Red in paint colors = True\n" + ] + } + ], "source": [ "# [ ] fix the error\n", "paint_colors = \"red, blue, green, black, orange, pink\"\n", - "print('Red in paint colors = ',red in paint_colors)\n", + "print(\"Red in paint colors = \", \"red\" in paint_colors)\n", "\n" ] }, @@ -3286,7 +4747,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -3300,9 +4761,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.1" + "version": "3.12.1" } }, "nbformat": 4, - "nbformat_minor": 1 + "nbformat_minor": 4 } diff --git a/P1 Python Absolute Beginner/Module_1.1_Practice.ipynb b/P1 Python Absolute Beginner/Module_1.1_Practice.ipynb index ad652b39..58fdfddf 100644 --- a/P1 Python Absolute Beginner/Module_1.1_Practice.ipynb +++ b/P1 Python Absolute Beginner/Module_1.1_Practice.ipynb @@ -3,7 +3,10 @@ { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "# P1M1 Module 1 Practice 1\n", @@ -39,10 +42,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello!\n" + ] + } + ], + "source": [ + "print(\"Hello!\")" + ] }, { "cell_type": "markdown", @@ -55,9 +68,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "watch for the cat\n" + ] + } + ], "source": [ "print('watch for the cat')" ] @@ -90,12 +111,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "This notebook belongs to Matthew Williams, 2/13/26\n" + ] + } + ], + "source": [ + "print(\"This notebook belongs to Matthew Williams, 2/13/26\")" + ] }, { "cell_type": "markdown", @@ -108,14 +137,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Matt\n", + "is using python\n" + ] + } + ], "source": [ "# [ ] print your name\n", - "\n", + "print(\"Matt\")\n", "# [ ] print \"is using Python\"\n", - "\n" + "print(\"is using python\")\n" ] }, { @@ -138,16 +176,22 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Matt\n" + ] + } + ], "source": [ "# [ ] create a variable your_name and assign it a sting containing your name\n", - "\n", + "your_name = \"Matt\"\n", "#[ ] print your_name\n", - "\n" + "print(your_name)\n" ] }, { @@ -161,15 +205,25 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "rosemary 11.5 7\n" + ] + } + ], "source": [ "# [ ] create variables and assign values for: favorite_song, shoe_size, lucky_number\n", - "\n", + "favorite_song = \"rosemary\"\n", + "shoe_size = \"11.5\"\n", + "lucky_number = \"7\"\n", "\n", "# [ ] print the value of each variable favorite_song, shoe_size, and lucky_number\n", - "\n", + "print(favorite_song,shoe_size,lucky_number)\n", "\n" ] }, @@ -185,18 +239,28 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "My favorite song is rosemary\n", + "My shoe size is 11.5\n", + "The luckiest number is 7\n" + ] + } + ], "source": [ "# [ ] print favorite_song with description\n", - "\n", + "print(\"My favorite song is\",favorite_song)\n", "\n", "# [ ] print shoe_size with description\n", - "\n", + "print(\"My shoe size is\",shoe_size)\n", "\n", "# [ ] print lucky_number with description\n", - "\n" + "print(\"The luckiest number is\",lucky_number)\n" ] }, { @@ -212,13 +276,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "My favorite song is rosemary but it only got to 11.5 on the charts, not #7\n" + ] + } + ], "source": [ "# assign favorite_lucky_shoe using\n", - "\n", - "\n" + "favorite_lucky_shoe = \"My favorite song is \" + favorite_song + \" but it only got to \" + shoe_size + \" on the charts, not #\" + lucky_number\n", + "print(favorite_lucky_shoe)\n" ] }, { @@ -240,19 +312,44 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "*\n", + " *\n", + " *\n", + " *\n", + "**********\n", + "* *\n", + "**********\n", + " * * \n", + " \n", + " * * \n", + " *** \n" + ] + } + ], "source": [ "# [ ] print a diagonal using \"*\"\n", - "\n", + "print(\"*\")\n", + "print(\" *\")\n", + "print(\" *\")\n", + "print(\" *\")\n", "\n", "# [ ] rectangle using \"*\"\n", - "\n", + "print(\"**********\")\n", + "print(\"* *\")\n", + "print(\"**********\")\n", "\n", "# [ ] smiley using \"*\"\n", - "\n", - "\n" + "print(\" * * \")\n", + "print(\" \")\n", + "print(\" * * \")\n", + "print(\" *** \")\n" ] }, { @@ -265,89 +362,177 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "str" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] display the type of 'your name' (use single quotes)\n", - "\n", + "type('your name')\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "str" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] display the type of \"save your notebook!\" (use double quotes)\n", - "\n", + "type(\"save your notebook!\")\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "str" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] display the type of \"25\" (use quotes)\n", - "\n", + "type(\"25\")\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "str" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] display the type of \"save your notebook \" + 'your name'\n", - "\n", + "type(\"save your notebook \" + 'your name')\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "int" + ] + }, + "execution_count": 28, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] display the type of 25 (no quotes)\n", - "\n", + "type(25)\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "int" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] display the type of 25 + 10 \n", - "\n", + "type(25 + 10)\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "float" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] display the type of 1.55\n", - "\n", + "type(1.55)\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 31, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "float" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] display the type of 1.55 + 25\n", - "\n", + "type(1.55 + 25)\n", "\n" ] }, @@ -362,10 +547,8 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, + "execution_count": 33, + "metadata": {}, "outputs": [], "source": [ "# assignments ***RUN THIS CELL*** before starting the section\n", @@ -378,77 +561,143 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 34, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "str" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] display the current type of the variable student_name\n", - "\n", + "type(student_name)\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 35, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "int" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] display the type of student_age\n", - "\n", + "type(student_age)\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 36, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "float" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] display the type of student_grade\n", - "\n", + "type(student_grade)\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 37, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "float" + ] + }, + "execution_count": 37, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] display the type of student_age + student_grade\n", - "\n", + "type(student_age + student_grade)\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 38, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "str" + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# [ ] display the current type of student_id\n", - "\n", + "type(student_id)\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 39, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + } + ], "source": [ "# assign new value to student_id \n", - "\n", + "student_id = 3\n", "\n", "# [ ] display the current of student_id\n", - "\n", + "print(type(student_id))\n", "\n" ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "#### number integer addition\n", @@ -458,14 +707,14 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, + "execution_count": 40, + "metadata": {}, "outputs": [], "source": [ "# [ ] create integer variables (x, y, z) and assign them 1-3 digit integers (no decimals - no quotes)\n", - "\n", + "x = 1\n", + "y = 2\n", + "z = 3\n", "\n" ] }, @@ -480,12 +729,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 42, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "6\n" + ] + } + ], "source": [ - "\n", - "\n" + "xyz_sum = x + y + z\n", + "print(xyz_sum)\n" ] }, { @@ -498,56 +755,89 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 43, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World!\n" + ] + } + ], "source": [ "# [ ] fix the error \n", "\n", - "print(\"Hello World!\"\") \n", + "print(\"Hello World!\") \n", "\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 44, "metadata": {}, - "outputs": [], - "source": [ + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "strings have quotes and variables have names\n" + ] + } + ], + "source": [ "# [ ] fix the error \n", - "print(strings have quotes and variables have names)\n", + "print(\"strings have quotes and variables have names\")\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "I have $5\n" + ] + } + ], "source": [ "# [ ] fix the error \n", - "print( \"I have $\" + 5)\n", + "print( \"I have $\" + \"5\")\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 47, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "always save the notebook\n" + ] + } + ], "source": [ "# [ ] fix the error \n", - "print('always save the notebook\")\n", + "print(\"always save the notebook\")\n", " \n" ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "## ASCII art\n", @@ -557,23 +847,57 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 48, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "M M W W\n", + "MM MM W W \n", + "M M M M W W W \n", + "M M M W W W W \n", + "M M W W \n" + ] + } + ], "source": [ "# [ ] ASCII ART\n", - "\n", + "# [ ] ASCII ART for initials\n", + "print(\"M M W W\")\n", + "print(\"MM MM W W \")\n", + "print(\"M M M M W W W \")\n", + "print(\"M M M W W W W \")\n", + "print(\"M M W W \")\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 49, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " /\\ \n", + " / \\ \n", + " /____\\ \n", + " | [] | \n", + " |____| \n" + ] + } + ], "source": [ "# [ ] ASCII ART\n", - "\n" + "# [ ] Challenge: ASCII Picture\n", + "print(\" /\\\\ \")\n", + "print(\" / \\\\ \")\n", + "print(\" /____\\\\ \")\n", + "print(\" | [] | \")\n", + "print(\" |____| \")\n" ] }, { @@ -600,27 +924,50 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": { "scrolled": true }, - "outputs": [], + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Remind me to: eat\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "eat\n" + ] + } + ], "source": [ "# [ ] get user input for a variable named remind_me\n", - "\n", + "remind_me = input(\"Remind me to: \")\n", "\n", "# [ ] print the value of the variable remind_me\n", - "\n" + "print(remind_me)\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 51, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Remember, 10\n" + ] + } + ], "source": [ "# use string addition to print \"remember: \" before the remind_me input string\n", - "\n" + "print(\"Remember,\",remind_me)\n" ] }, { @@ -639,23 +986,43 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 54, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "What is the meeting subject? grad party\n", + "What is the meeting time? 7:00PM\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Meeting Subject: grad party\n", + "Meeting Time: 7:00PM\n" + ] + } + ], "source": [ "# [ ] get user input for 2 variables: meeting_subject and meeting_time\n", - "\n", - "\n", + "meeting_subject = input(\"What is the meeting subject? \")\n", + "meeting_time = input(\"What is the meeting time? \")\n", "# [ ] use string addition to print meeting subject and time with labels\n", - "\n", - "\n", + "print(\"Meeting Subject:\",meeting_subject)\n", + "print(\"Meeting Time:\",meeting_time)\n", "\n" ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "## print() formatting \n", @@ -664,38 +1031,65 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 56, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Wednesday is in the middle of the week.\n" + ] + } + ], "source": [ "# [ ] print the combined strings \"Wednesday is\" and \"in the middle of the week\" \n", - "\n" + "print(\"Wednesday is\",\"in the middle of the week.\")\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Remember to eat\n" + ] + } + ], "source": [ "# [ ] print combined string \"Remember to\" and the string variable remind_me from input above\n", - "\n" + "print(\"Remember to\",remind_me)\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "I like to eat and my shoe size is 11.5 but my luckiest number is 7\n" + ] + } + ], "source": [ "# [ ] Combine 3 variables from above with multiple strings\n", - "\n" + "print(\"I like to\",remind_me, \"and my shoe size is\", shoe_size, \"but my luckiest number is\", lucky_number)\n" ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "### print() quotation marks" @@ -703,30 +1097,50 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "It's a great day to practice Python!\n" + ] + } + ], "source": [ "# [ ] print a string sentence that will display an Apostrophe (')\n", - "\n", + "print(\"It's a great day to practice Python!\")\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\"I like to eat\" bananas.\n" + ] + } + ], "source": [ "# [ ] print a string sentence that will display a quote(\") or quotes\n", - "\n", + "albert_quote = '\"I like to eat\"'\n", + "print(albert_quote,\"bananas.\")\n", "\n" ] }, { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "## Boolean string tests" @@ -748,32 +1162,73 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Enter a type of vehicle: Mustang\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "All Alpha: True\n", + "Alphanumeric: True\n", + "Is Capitalized: True\n", + "Is Lowercase: False\n" + ] + } + ], "source": [ "# [ ] complete vehicle tests \n", + "vehicle = input(\"Enter a type of vehicle: \")\n", "\n", - "\n", + "print(\"All Alpha:\", vehicle.isalpha())\n", + "print(\"Alphanumeric:\", vehicle.isalnum())\n", + "print(\"Is Capitalized:\", vehicle.istitle())\n", + "print(\"Is Lowercase:\", vehicle.islower())\n", "\n", "\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Enter a color: Red\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Starts with 'b': False\n" + ] + } + ], "source": [ "# [ ] print True or False if color starts with \"b\" \n", - "\n" + "color = input(\"Enter a color: \")\n", + "print(\"Starts with 'b':\", color.lower().startswith(\"b\"))\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "outputs": [], "source": [] @@ -787,57 +1242,110 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The time is noon.\n" + ] + } + ], "source": [ "# [ ] print the string variable capital_this Capitalizing only the first letter\n", "capitalize_this = \"the TIME is Noon.\"\n", - "\n" + "print(capitalize_this.capitalize())\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Who WRITES like This?\n" + ] + } + ], "source": [ "# print the string variable swap_this in swapped case\n", "swap_this = \"wHO writes LIKE tHIS?\"\n", - "\n" + "print(swap_this.swapcase())\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "can you hear me?\n" + ] + } + ], "source": [ "# print the string variable whisper_this in all lowercase\n", "whisper_this = \"Can you hear me?\"\n", - "\n" + "print(whisper_this.lower())\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "CAN YOU HEAR ME NOW!?\n" + ] + } + ], "source": [ "# print the string variable yell_this in all UPPERCASE\n", "yell_this = \"Can you hear me Now!?\"\n", - "\n" + "print(yell_this.upper())\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "enter a string to reformat: Mustang\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Uppercase: MUSTANG\n", + "Lowercase: mustang\n", + "Swapcase: mUSTANG\n", + "Capitalized: Mustang\n" + ] + } + ], "source": [ "#format input using .upper(), .lower(), .swapcase, .capitalize()\n", "format_input = input('enter a string to reformat: ')\n", - "\n" + "print(\"Uppercase:\", format_input.upper())\n", + "print(\"Lowercase:\", format_input.lower())\n", + "print(\"Swapcase:\", format_input.swapcase())\n", + "print(\"Capitalized:\", format_input.capitalize())\n" ] }, { @@ -849,41 +1357,92 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Enter a color: Red\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "red\n" + ] + } + ], "source": [ "# [ ] get user input for a variable named color\n", "# [ ] modify color to be all lowercase and print\n", - "\n" + "color = input(\"Enter a color: \").lower()\n", + "print(color)\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Enter a reminder: To eat\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "to eat\n" + ] + } + ], "source": [ "# [ ] get user input using variable remind_me and format to all **lowercase** and print\n", "# [ ] test using input with mixed upper and lower cases\n", - "\n" + "remind_me = input(\"Enter a reminder: \").lower()\n", + "print(remind_me)\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "What do you want to yell? matt\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "MATT\n" + ] + } + ], "source": [ "# [] get user input for the variable yell_this and format as a \"YELL\" to ALL CAPS\n", - "\n" + "yell_this = input(\"What do you want to yell? \").upper()\n", + "print(yell_this)\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "outputs": [], "source": [] @@ -898,34 +1457,63 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "List some animals: Cat, dog\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Is 'cat' in your list? True\n" + ] + } + ], "source": [ "# [ ] get user input for the name of some animals in the variable animals_input\n", - "\n", + "animals_input = input(\"List some animals: \").lower()\n", "\n", "# [ ] print true or false if 'cat' is in the string variable animals_input\n", - "\n" + "print(\"Is 'cat' in your list?\", \"cat\" in animals_input)\n" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Enter a color: Red\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Starts with 'b': False\n", + "The original color entered was: Red\n" + ] + } + ], "source": [ "# [ ] get user input for color\n", - "\n", + "color_test = input(\"Enter a color: \")\n", "\n", "# [ ] print True or False for starts with \"b\"\n", - "\n", + "print(\"Starts with 'b':\", color_test.lower().startswith(\"b\"))\n", "\n", "# [ ] print color variable value exactly as input \n", "# test with input: \"Blue\", \"BLUE\", \"bLUE\"\n", - "\n", + "print(\"The original color entered was:\", color_test)\n", "\n", "\n" ] @@ -951,20 +1539,36 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Enter a type of reading material (e.g. blog): blog\n", + "Enter three things you can read: Book, blog, catalog\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "item found = True\n" + ] + } + ], "source": [ "# project: \"guess what I'm reading\"\n", "\n", "# 1[ ] get 1 word input for can_read variable\n", - "\n", + "can_read = input(\"Enter a type of reading material (e.g. blog): \").lower()\n", "\n", "# 2[ ] get 3 things input for can_read_things variable\n", - "\n", + "can_read_things = input(\"Enter three things you can read: \").lower()\n", "\n", "# 3[ ] print True if can_read is in can_read_things\n", - "\n", + "print(\"item found =\", can_read in can_read_things)\n", "\n", "# [] challenge: format the output to read \"item found = True\" (or false)\n", "# hint: look print formatting exercises\n", @@ -990,14 +1594,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 37, "metadata": {}, "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Give me a food to test: nUts\n" + ] + }, { "name": "stdout", "output_type": "stream", "text": [ - "True\n" + "False\n", + "True\n", + "Seafood check: False\n", + "Chocolate check: False\n" ] } ], @@ -1005,7 +1619,7 @@ "# Allergy check \n", "\n", "# 1[ ] get input for test (prompt user to enter something like \"nuts\" or \"dairy\" to store in variable named \"test\")\n", - "test_food = input(\"Give me a food to test: \")\n", + "test_food = input(\"Give me a food to test: \").lower()\n", "\n", "\n", "# 2/3[ ] print True if \"dairy\" is in the input or False if not\n", @@ -1014,9 +1628,9 @@ "# 4[ ] Check if \"nuts\" are in the input\n", "print(\"nuts\" in test_food)\n", "# 4+[ ] Challenge: Check if \"seafood\" is in the input\n", - "\n", + "print(\"Seafood check:\", \"seafood\" in test_food)\n", "# 4+[ ] Challenge: Check if \"chocolate\" is in the input\n", - "\n" + "print(\"Chocolate check:\", \"chocolate\" in test_food)\n" ] }, { @@ -1030,7 +1644,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -1044,9 +1658,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.1" + "version": "3.12.1" } }, "nbformat": 4, - "nbformat_minor": 1 + "nbformat_minor": 4 } diff --git a/P1 Python Absolute Beginner/Module_1.2_Required_Code.ipynb b/P1 Python Absolute Beginner/Module_1.2_Required_Code.ipynb index be0b3c0e..342f5a0f 100644 --- a/P1 Python Absolute Beginner/Module_1.2_Required_Code.ipynb +++ b/P1 Python Absolute Beginner/Module_1.2_Required_Code.ipynb @@ -4,7 +4,10 @@ "attachments": {}, "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "# P1M1: Module 1 Required Coding Activity \n", @@ -33,25 +36,42 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": true - }, - "outputs": [], + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Names of people met in past 24 hours: Josh, Matt, Seth, jOhn\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "josh, matt, seth, john\n", + "John met? True\n", + "Matt met? True\n", + "Josh met? True\n", + "Seth met? True\n" + ] + } + ], "source": [ "# Create name check code\n", - "\n", + "input_test = input(\"Names of people met in past 24 hours: \").lower()\n", "# [ ] get input for input_test variable\n", - "\n", + "print(input_test)\n", "# [ ] print \"True\" message if \"John\" is in the input or False message if not\n", - "\n", + "print(\"John met?\", \"john\" in input_test)\n", "\n", "# [ ] print True message if your name is in the input or False if not\n", - "\n", + "print(\"Matt met?\", \"matt\" in input_test)\n", "\n", "# [ ] Challenge: Check if another person's name is in the input - print message\n", - "\n", - "\n", + "print(\"Josh met?\", \"josh\" in input_test)\n", + "print(\"Seth met?\", \"seth\" in input_test)\n", "# [ ] Challenge: Check if a fourth person's name is in the input - print message" ] }, @@ -65,7 +85,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -79,9 +99,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.8" + "version": "3.12.1" } }, "nbformat": 4, - "nbformat_minor": 1 + "nbformat_minor": 4 } diff --git a/P1 Python Absolute Beginner/p1m1matthewwilliams.ipynb b/P1 Python Absolute Beginner/p1m1matthewwilliams.ipynb new file mode 100644 index 00000000..2879a74a --- /dev/null +++ b/P1 Python Absolute Beginner/p1m1matthewwilliams.ipynb @@ -0,0 +1,67 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "8148dccc-93f6-4c65-933a-ecc33e14cc87", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Names of people met in past 24 hours: Josh, sEth, maTt, johN\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "josh, seth, matt, john\n", + "John met? True\n", + "Matt met? True\n", + "Josh met? True\n", + "Seth met? True\n" + ] + } + ], + "source": [ + "# Create name check code\n", + "input_test = input(\"Names of people met in past 24 hours: \").lower()\n", + "# [ ] get input for input_test variable\n", + "print(input_test)\n", + "# [ ] print \"True\" message if \"John\" is in the input or False message if not\n", + "print(\"John met?\", \"john\" in input_test)\n", + "\n", + "# [ ] print True message if your name is in the input or False if not\n", + "print(\"Matt met?\", \"matt\" in input_test)\n", + "\n", + "# [ ] Challenge: Check if another person's name is in the input - print message\n", + "print(\"Josh met?\", \"josh\" in input_test)\n", + "print(\"Seth met?\", \"seth\" in input_test)\n", + "# [ ] Challenge: Check if a fourth person's name is in the input - print message\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.1" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/P1 Python Absolute Beginner/pythonteachingcode.code-workspace b/P1 Python Absolute Beginner/pythonteachingcode.code-workspace new file mode 100644 index 00000000..2a0ed79b --- /dev/null +++ b/P1 Python Absolute Beginner/pythonteachingcode.code-workspace @@ -0,0 +1,7 @@ +{ + "folders": [ + { + "path": ".." + } + ] +} \ No newline at end of file diff --git a/Untitled.ipynb b/Untitled.ipynb new file mode 100644 index 00000000..363fcab7 --- /dev/null +++ b/Untitled.ipynb @@ -0,0 +1,6 @@ +{ + "cells": [], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 5 +}