diff --git a/02_activities/assignments/assignment_1.ipynb b/02_activities/assignments/assignment_1.ipynb index 2dca19d0b..62abc1b1a 100644 --- a/02_activities/assignments/assignment_1.ipynb +++ b/02_activities/assignments/assignment_1.ipynb @@ -58,11 +58,34 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Silent et Listen can be anagrams\n" + ] + } + ], "source": [ "# For testing purposes, we will write our code in the function\n", "def anagram_checker(word_a, word_b):\n", - " # Your code here\n", + " \"\"\" This function has built to check:\n", + " 1. If two given words can be anagrams of each other.\n", + " 2. You should type each word one after another as required to get your result.\"\"\"\n", + "\n", + "# Using the “input” function to prompt the user to enter both words.\n", + " word_a = str(input(\"Please enter your first word\"))\n", + " word_b = str(input(\"Please enter your second word\"))\n", + "\n", + "#Sorting in ascending order each word prompted by the user\n", + " sorted_lowercase_word_a = sorted(word_a.lower())\n", + " sorted_lowercase_word_b = sorted(word_b.lower())\n", + "\n", + " if sorted_lowercase_word_a == sorted_lowercase_word_b:\n", + " print(f\"{word_a} et {word_b} can be anagrams\")\n", + " else :\n", + " print(f\"{word_a} et {word_b} are not anagrams each other\")\n", "\n", "# Run your code to check using the words below:\n", "anagram_checker(\"Silent\", \"listen\")" @@ -70,18 +93,34 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Silent et Night are not anagrams each other\n" + ] + } + ], "source": [ "anagram_checker(\"Silent\", \"Night\")" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "night et Thing can be anagrams\n" + ] + } + ], "source": [ "anagram_checker(\"night\", \"Thing\")" ] @@ -99,10 +138,34 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "def anagram_checker(word_a, word_b, is_case_sensitive):\n", - " # Modify your existing code here\n", + "def anagram_checker(word_a, word_b, is_case_sensitive = True):\n", + " \"\"\" This function has built to check:\n", + " 1. If two given words can be anagrams of each other when checking for case sensitive or not\n", + " 2. It contains three parameters.You should type word_a and word_b one after another as required to get your result.\"\"\"\n", + "\n", + "# Using the “input” function to prompt the user to enter both words.\n", + " word_a = str(input(\"Please enter your first word\"))\n", + " word_b = str(input(\"Please enter your second word\"))\n", + "\n", + " if is_case_sensitive:\n", + " return sorted(word_a) == sorted(word_b)\n", + " else:\n", + " return sorted(word_a.lower()) == sorted(word_b.lower())\n", + "\n", + " \n", "\n", "# Run your code to check using the words below:\n", "anagram_checker(\"Silent\", \"listen\", False) # True" @@ -110,18 +173,40 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "anagram_checker(\"Silent\", \"listen\", True) # False" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "anagram_checker(\"Silent\", \"Listen\", True) # False" ] @@ -139,7 +224,7 @@ ], "metadata": { "kernelspec": { - "display_name": "new-learner", + "display_name": "python-env (3.11.15)", "language": "python", "name": "python3" }, @@ -153,7 +238,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.15" } }, "nbformat": 4, diff --git a/jupyther_sample1.ipynb b/jupyther_sample1.ipynb new file mode 100644 index 000000000..6f0b1ba24 --- /dev/null +++ b/jupyther_sample1.ipynb @@ -0,0 +1,311 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "e8ebb108", + "metadata": {}, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'total' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[1;32mIn[1], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28mprint\u001b[39m (total)\n", + "\u001b[1;31mNameError\u001b[0m: name 'total' is not defined" + ] + } + ], + "source": [ + "print (total)" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "4df3eaaa", + "metadata": {}, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "invalid decimal literal (2049746400.py, line 1)", + "output_type": "error", + "traceback": [ + "\u001b[1;36m Cell \u001b[1;32mIn[2], line 1\u001b[1;36m\u001b[0m\n\u001b[1;33m 3number = 10\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid decimal literal\n" + ] + } + ], + "source": [ + "3number = 10" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "0415252b", + "metadata": {}, + "outputs": [], + "source": [ + "def Far_To_Cel(Farheneit):\n", + " #This function transform Farheneit degrees to celcius\n", + " return ((Farheneit - 32)*5/9)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "950745e5", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "25.555555555555557" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Far_To_Cel(78)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e6366c12", + "metadata": {}, + "outputs": [], + "source": [ + "def even_number(number):\n", + " \"\"\" This function allows to determine if a number\n", + " is odd or even\n", + " \n", + " It has only one parameter: number\"\"\"\n", + " return(This number is)" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "d151c34f", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "647\n" + ] + } + ], + "source": [ + "number = \"(647)-225-7154\"\n", + "\n", + "print(number[1:4])" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "dcf55d63", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "superc\n" + ] + } + ], + "source": [ + "word = \"supercalifragilisticexpialidocious\"\n", + "print(word[:6])" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "c78f8156", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'i am not yellow yet'" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "\"I am Not YelloW yet\".lower()" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "c930cd19", + "metadata": {}, + "outputs": [], + "source": [ + "def greet_user():\n", + " name = input(\"Enter your name\")\n", + " return (f\"Hello,{name}\")" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "07d524fc", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Hello,Guimard'" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "greet_user()" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "a67d286b", + "metadata": {}, + "outputs": [], + "source": [ + "favorite_color = input(\"What is your favorite color\")" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "64e015de", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Blue'" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "favorite_color" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "e540652f", + "metadata": {}, + "outputs": [], + "source": [ + "def full_name():\n", + " first_name = input(\"Please enter your first name\")\n", + " last_name = input(\"Please enter your last name\")\n", + " return (f\"{first_name} {last_name}\")" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "278a7bc4", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Gui Joe'" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "full_name()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e2fa78b3", + "metadata": {}, + "outputs": [], + "source": [ + "def Weather_Intensity():\n", + " temperature = int(input(\"What is the current temperature? \"))\n", + " if temp < 0:\n", + " print(\"It's freezing cold!\")\n", + " elif 1 < temp < 15:\n", + " print(\"It's cold!\")\n", + " elif 16 <= temp < 30:\n", + " print(\"It's hot!\")\n", + " elif 31 < temp <= 45:\n", + " print(\"It's really hot!\")\n", + " else:\n", + " print(\"It's extremely hot!\")" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "cd840718", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "It's extremely hot!\n" + ] + } + ], + "source": [ + "Weather_Intensity()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "base", + "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.11.7" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}