From 42df2861d0f23ac29da688c84a9f32c8ef5716be Mon Sep 17 00:00:00 2001 From: Ariel M Diaz Date: Sat, 18 May 2024 23:20:54 -0300 Subject: [PATCH 1/5] Done M3 --- .../Prep_Course_Homework_03-Resuelto.ipynb | 115 +++--- .../Prep_Course_Homework_03-Resuelto.py | 4 +- .../Prep_Course_Homework_03.ipynb | 389 ++++++++++++++---- 3 files changed, 357 insertions(+), 151 deletions(-) diff --git a/M03_variablesydatos/Prep_Course_Homework_03-Resuelto.ipynb b/M03_variablesydatos/Prep_Course_Homework_03-Resuelto.ipynb index e3f2739bb..45fca9383 100644 --- a/M03_variablesydatos/Prep_Course_Homework_03-Resuelto.ipynb +++ b/M03_variablesydatos/Prep_Course_Homework_03-Resuelto.ipynb @@ -18,7 +18,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 45, "metadata": {}, "outputs": [ { @@ -44,7 +44,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 48, "metadata": {}, "outputs": [ { @@ -53,13 +53,13 @@ "float" ] }, - "execution_count": 3, + "execution_count": 48, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "type(8.5)" + "type(8.5)\n" ] }, { @@ -72,7 +72,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 46, "metadata": {}, "outputs": [ { @@ -81,7 +81,7 @@ "int" ] }, - "execution_count": 8, + "execution_count": 46, "metadata": {}, "output_type": "execute_result" } @@ -100,11 +100,11 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 26, "metadata": {}, "outputs": [], "source": [ - "mi_nombre = 'Juan Carlos Perez'" + "mi_nombre = 'Ariel Marcelo Diaz'" ] }, { @@ -117,7 +117,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 27, "metadata": {}, "outputs": [], "source": [ @@ -134,7 +134,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 28, "metadata": {}, "outputs": [ { @@ -143,7 +143,7 @@ "complex" ] }, - "execution_count": 4, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } @@ -162,7 +162,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 29, "metadata": {}, "outputs": [], "source": [ @@ -179,7 +179,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 49, "metadata": {}, "outputs": [], "source": [ @@ -197,7 +197,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 56, "metadata": {}, "outputs": [ { @@ -222,7 +222,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 32, "metadata": {}, "outputs": [], "source": [ @@ -239,7 +239,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -266,14 +266,14 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 52, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "(4.61+1j)\n" + "13.61\n" ] } ], @@ -292,7 +292,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 53, "metadata": {}, "outputs": [ { @@ -317,7 +317,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 36, "metadata": {}, "outputs": [ { @@ -342,7 +342,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 57, "metadata": {}, "outputs": [ { @@ -368,7 +368,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 38, "metadata": {}, "outputs": [ { @@ -393,7 +393,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 39, "metadata": {}, "outputs": [ { @@ -402,7 +402,7 @@ "3" ] }, - "execution_count": 1, + "execution_count": 39, "metadata": {}, "output_type": "execute_result" } @@ -421,7 +421,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 40, "metadata": {}, "outputs": [ { @@ -430,7 +430,7 @@ "27" ] }, - "execution_count": 2, + "execution_count": 40, "metadata": {}, "output_type": "execute_result" } @@ -449,7 +449,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 41, "metadata": {}, "outputs": [ { @@ -476,7 +476,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 42, "metadata": {}, "outputs": [ { @@ -485,7 +485,7 @@ "False" ] }, - "execution_count": 4, + "execution_count": 42, "metadata": {}, "output_type": "execute_result" } @@ -504,7 +504,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 43, "metadata": {}, "outputs": [ { @@ -513,7 +513,7 @@ "True" ] }, - "execution_count": 11, + "execution_count": 43, "metadata": {}, "output_type": "execute_result" } @@ -532,23 +532,11 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 59, "metadata": {}, - "outputs": [ - { - "ename": "ValueError", - "evalue": "could not convert string to float: '3,8'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m~\\AppData\\Local\\Temp/ipykernel_17308/3442311956.py\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0ma\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mfloat\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'3,8'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[1;31mValueError\u001b[0m: could not convert string to float: '3,8'" - ] - } - ], + "outputs": [], "source": [ - "a = float('3,8')" + "a = float(3.8)" ] }, { @@ -561,7 +549,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -588,7 +576,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -631,28 +619,27 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 60, "metadata": {}, "outputs": [ { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'int' and 'str'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m~\\AppData\\Local\\Temp/ipykernel_17308/1287754560.py\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[1;36m2\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;34m'2'\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'int' and 'str'" - ] + "data": { + "text/plain": [ + "4" + ] + }, + "execution_count": 60, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "2 + '2'" + "2 + 2" ] }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -672,7 +659,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -692,7 +679,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -720,7 +707,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -757,7 +744,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.11" + "version": "3.12.2" } }, "nbformat": 4, diff --git a/M03_variablesydatos/Prep_Course_Homework_03-Resuelto.py b/M03_variablesydatos/Prep_Course_Homework_03-Resuelto.py index 2c9056576..92c46684c 100644 --- a/M03_variablesydatos/Prep_Course_Homework_03-Resuelto.py +++ b/M03_variablesydatos/Prep_Course_Homework_03-Resuelto.py @@ -33,7 +33,7 @@ # In[2]: -mi_nombre = 'juan carlos perez' +mi_nombre = 'Ariel Marcelo Diaz' # 5) Crear una variable que contenga un número complejo @@ -210,7 +210,7 @@ # In[23]: -2 + '2' +2 + 2 # In[25]: diff --git a/M03_variablesydatos/Prep_Course_Homework_03.ipynb b/M03_variablesydatos/Prep_Course_Homework_03.ipynb index b4d68b08b..e0ed8b944 100644 --- a/M03_variablesydatos/Prep_Course_Homework_03.ipynb +++ b/M03_variablesydatos/Prep_Course_Homework_03.ipynb @@ -18,10 +18,21 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "8\n" + ] + } + ], + "source": [ + "a=8\n", + "print(a)" + ] }, { "attachments": {}, @@ -33,10 +44,23 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "float" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "type(8.5)" + ] }, { "attachments": {}, @@ -48,10 +72,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "8\n" + ] + } + ], + "source": [ + "print(a)" + ] }, { "attachments": {}, @@ -66,7 +100,9 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "name = \"Ariel Marcelo Diaz \"" + ] }, { "attachments": {}, @@ -78,10 +114,12 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "num = 4 + 6j" + ] }, { "attachments": {}, @@ -93,10 +131,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(4+6j)\n" + ] + } + ], + "source": [ + "print(num)" + ] }, { "attachments": {}, @@ -111,7 +159,9 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "pi = 3.1416" + ] }, { "attachments": {}, @@ -123,10 +173,13 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "a = 'True' #String\n", + "b = True #boolean" + ] }, { "attachments": {}, @@ -138,10 +191,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " \n" + ] + } + ], + "source": [ + "print(type(a),type(b))" + ] }, { "attachments": {}, @@ -153,10 +216,12 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "sum = 4 + 2.5" + ] }, { "attachments": {}, @@ -168,10 +233,22 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(10+5j)\n" + ] + } + ], + "source": [ + "a = 4 + 3j\n", + "b = 6 + 2j\n", + "print(a + b)" + ] }, { "attachments": {}, @@ -183,10 +260,21 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(10.5+2j)\n" + ] + } + ], + "source": [ + "a = 4.5\n", + "print(a +b)\n" + ] }, { "attachments": {}, @@ -198,10 +286,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "18\n" + ] + } + ], + "source": [ + "print(3*6)" + ] }, { "attachments": {}, @@ -216,7 +314,9 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "print(2**8)" + ] }, { "attachments": {}, @@ -228,10 +328,21 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "6.75\n" + ] + } + ], + "source": [ + "a=27/4\n", + "print(a)" + ] }, { "attachments": {}, @@ -243,10 +354,22 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "6\n", + "6\n" + ] + } + ], + "source": [ + "print(int(a)) \n", + "print(27//4)" + ] }, { "attachments": {}, @@ -258,10 +381,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3\n" + ] + } + ], + "source": [ + "print(27%4)" + ] }, { "attachments": {}, @@ -276,7 +409,9 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "6 * 4 + 3" + ] }, { "attachments": {}, @@ -288,10 +423,22 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hola mundo\n" + ] + } + ], + "source": [ + "var1 = \"hola \"\n", + "var2 = \"mundo\"\n", + "print(var1+var2)" + ] }, { "attachments": {}, @@ -303,10 +450,23 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "2 == \"2\" #Distinto tipo String y entero" + ] }, { "attachments": {}, @@ -318,10 +478,23 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "int(\"2\") == 2" + ] }, { "attachments": {}, @@ -333,10 +506,21 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3.8\n" + ] + } + ], + "source": [ + "a = float(\"3.8\") #se transforma a punto flotante\n", + "print(a)" + ] }, { "attachments": {}, @@ -348,10 +532,22 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 38, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2\n" + ] + } + ], + "source": [ + "c = 3\n", + "c -= 1\n", + "print(c)" + ] }, { "attachments": {}, @@ -363,10 +559,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 39, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4\n" + ] + } + ], + "source": [ + "print(1<<2) " + ] }, { "attachments": {}, @@ -378,10 +584,12 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 42, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "f = 2 + float('2') #los valores deben ser iguales" + ] }, { "attachments": {}, @@ -393,10 +601,21 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 44, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4\n" + ] + } + ], + "source": [ + "f = 2 + int(\"2\")\n", + "print(f)" + ] } ], "metadata": { @@ -418,7 +637,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.11" + "version": "3.12.2" } }, "nbformat": 4, From bcf93c93e1df1a55a677702cae0596d487ec022d Mon Sep 17 00:00:00 2001 From: Ariel M Diaz Date: Sun, 19 May 2024 19:58:10 -0300 Subject: [PATCH 2/5] DONE M04 --- .../Prep_Course_Homework_04.ipynb | 389 ++++++++++++++++-- 1 file changed, 352 insertions(+), 37 deletions(-) diff --git a/M04_flujosdecontrol/Prep_Course_Homework_04.ipynb b/M04_flujosdecontrol/Prep_Course_Homework_04.ipynb index 8b5ecb46c..f16ced39f 100644 --- a/M04_flujosdecontrol/Prep_Course_Homework_04.ipynb +++ b/M04_flujosdecontrol/Prep_Course_Homework_04.ipynb @@ -18,10 +18,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Es igual a cero\n" + ] + } + ], + "source": [ + "var1 = int(input(\"ingrese un numero entero\"))\n", + "if(var1 == 0):\n", + " print(\"Es igual a cero\")\n", + "elif(var1>0) :\n", + " print(\"Es mayor que cero\")\n", + "else:\n", + " print(\"El menor que cero\")" + ] }, { "attachments": {}, @@ -33,10 +49,25 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "No son del mismo tipo\n" + ] + } + ], + "source": [ + "a = 10\n", + "b=\"hola mundo\"\n", + "if(type(a) == type(b)):\n", + " print(\"son del mismo tipo\")\n", + "else:\n", + " print(\"No son del mismo tipo\")" + ] }, { "attachments": {}, @@ -48,10 +79,43 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "El numero 1 es impar\n", + "El numero 2 es par\n", + "El numero 3 es impar\n", + "El numero 4 es par\n", + "El numero 5 es impar\n", + "El numero 6 es par\n", + "El numero 7 es impar\n", + "El numero 8 es par\n", + "El numero 9 es impar\n", + "El numero 10 es par\n", + "El numero 11 es impar\n", + "El numero 12 es par\n", + "El numero 13 es impar\n", + "El numero 14 es par\n", + "El numero 15 es impar\n", + "El numero 16 es par\n", + "El numero 17 es impar\n", + "El numero 18 es par\n", + "El numero 19 es impar\n", + "El numero 20 es par\n" + ] + } + ], + "source": [ + "for i in range(1,21):\n", + " if((i%2)==0):\n", + " print(\"El numero \"+str(i)+\" es par\")\n", + " else:\n", + " print(\"El numero \"+str(i)+\" es impar\")" + ] }, { "attachments": {}, @@ -63,10 +127,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n", + "1\n", + "8\n", + "27\n", + "64\n", + "125\n" + ] + } + ], + "source": [ + "for i in range(6):\n", + " print(i**3)" + ] }, { "attachments": {}, @@ -78,10 +158,28 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "Done!!4\n" + ] + } + ], + "source": [ + "n = int(input(\"Ingresar N\"))\n", + "for i in range(n):\n", + " print(i)\n", + "print(\"Done!!\" )" + ] }, { "attachments": {}, @@ -93,10 +191,30 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "El factorial es 6\n" + ] + } + ], + "source": [ + "var = int(input(\"Ingresar el nro\"))\n", + "if(var>0):\n", + " i = 2\n", + " fact = 1\n", + " while(i<=var):\n", + " fact *= i\n", + " i+=1\n", + " print(\"El factorial es \"+str(fact)) \n", + "else:\n", + " print(\"el nro es menor o igual a cero\") \n", + " " + ] }, { "attachments": {}, @@ -108,10 +226,66 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n" + ] + } + ], + "source": [ + "n = int(input(\"ingrese un numero entero\"))\n", + "j=1\n", + "while(j < n):\n", + " for i in range(n):\n", + " print(i)\n", + " j+=1" + ] }, { "attachments": {}, @@ -123,10 +297,36 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1\n", + "2\n", + "3\n", + "1\n", + "2\n", + "3\n", + "1\n", + "2\n", + "3\n", + "1\n", + "2\n", + "3\n" + ] + } + ], + "source": [ + "n = int(input(\"ingrese un numero entero\"))\n", + "for i in range(n):\n", + " j=1\n", + " while(j < n):\n", + " print(j)\n", + " j+=1" + ] }, { "attachments": {}, @@ -138,10 +338,36 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]\n" + ] + } + ], + "source": [ + "def es_primo(numero, divisor):\n", + " if divisor * divisor > numero:\n", + " return True\n", + " elif numero % divisor == 0:\n", + " return False\n", + " else:\n", + " return es_primo(numero, divisor + 1)\n", + "\n", + "def obtener_primos_anteriores(n):\n", + " primos_anteriores = []\n", + " for numero in range(2, n):\n", + " if es_primo(numero, 2):\n", + " primos_anteriores.append(numero)\n", + " return primos_anteriores\n", + "\n", + "n= 30\n", + "print(obtener_primos_anteriores(n))" + ] }, { "attachments": {}, @@ -156,7 +382,9 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "# como esta realizado de forma recursiva, concidero que no es necesario incorporar break o continue" + ] }, { "attachments": {}, @@ -171,7 +399,9 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "# El proceso se optimizo por la teoria de la criba de Erastoleles" + ] }, { "attachments": {}, @@ -183,10 +413,43 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "108\n", + "120\n", + "132\n", + "144\n", + "156\n", + "168\n", + "180\n", + "192\n", + "204\n", + "216\n", + "228\n", + "240\n", + "252\n", + "264\n", + "276\n", + "288\n", + "300\n" + ] + } + ], + "source": [ + "def div12(ini = 100, fin =300):\n", + " if(ini > fin ):\n", + " return\n", + " if((ini % 12)==0):\n", + " print(ini)\n", + " div12(ini + 1,fin)\n", + "div12()\n", + " " + ] }, { "attachments": {}, @@ -201,7 +464,10 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "n = int(input(\"ingrese un numero por favor\"))\n", + "print(obtener_primos_anteriores(n))" + ] }, { "attachments": {}, @@ -213,10 +479,59 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "102\n", + "108\n", + "114\n", + "120\n", + "126\n", + "132\n", + "138\n", + "144\n", + "150\n", + "156\n", + "162\n", + "168\n", + "174\n", + "180\n", + "186\n", + "192\n", + "198\n", + "204\n", + "210\n", + "216\n", + "222\n", + "228\n", + "234\n", + "240\n", + "246\n", + "252\n", + "258\n", + "264\n", + "270\n", + "276\n", + "282\n", + "288\n", + "294\n", + "300\n" + ] + } + ], + "source": [ + "def div36(ini = 100, fin =300):\n", + " if(ini > fin ):\n", + " return\n", + " if(((ini % 3)==0) and ((ini % 6)==0)):\n", + " print(ini)\n", + " div36(ini + 1,fin)\n", + "div36()" + ] } ], "metadata": { @@ -238,7 +553,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.6" + "version": "3.12.2" } }, "nbformat": 4, From 80f8f603c65632dfce0e61123072aea80ed8985f Mon Sep 17 00:00:00 2001 From: Ariel M Diaz Date: Thu, 23 May 2024 15:19:50 -0300 Subject: [PATCH 3/5] Done M05 --- .../Prep_Course_Homework_05.ipynb | 419 ++++++++++++++---- 1 file changed, 331 insertions(+), 88 deletions(-) diff --git a/M05_estructuradedatos/Prep_Course_Homework_05.ipynb b/M05_estructuradedatos/Prep_Course_Homework_05.ipynb index c71642967..de5aca924 100644 --- a/M05_estructuradedatos/Prep_Course_Homework_05.ipynb +++ b/M05_estructuradedatos/Prep_Course_Homework_05.ipynb @@ -18,10 +18,22 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + } + ], + "source": [ + "list = [\"Madrid\",\"Buenos Aires\",\"Brazilia\",\"Ciudad de Mexico\"]\n", + "\n", + "print(list)" + ] }, { "attachments": {}, @@ -33,10 +45,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Buenos Aires\n" + ] + } + ], + "source": [ + "print(list[1])" + ] }, { "attachments": {}, @@ -48,10 +70,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Buenos Aires', 'Brazilia']\n" + ] + } + ], + "source": [ + "print(list[1:3])" + ] }, { "attachments": {}, @@ -66,7 +98,9 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "print(type(list))" + ] }, { "attachments": {}, @@ -78,10 +112,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Brazilia']\n" + ] + } + ], + "source": [ + "print(list[2:])" + ] }, { "attachments": {}, @@ -93,10 +137,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Madrid', 'Buenos Aires', 'Brazilia']\n" + ] + } + ], + "source": [ + "print(list[:3])" + ] }, { "attachments": {}, @@ -108,10 +162,22 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Madrid', 'Buenos Aires', 'Brazilia', 'Madrid', 'Madrid', 'Congo']\n" + ] + } + ], + "source": [ + "list.append(\"Madrid\")\n", + "list.append(\"Congo\")\n", + "print(list)" + ] }, { "attachments": {}, @@ -123,10 +189,21 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Madrid', 'Buenos Aires', 'Brazilia', 'Guajira', 'Madrid', 'Madrid', 'Congo']\n" + ] + } + ], + "source": [ + "list.insert(3,\"Guajira\")\n", + "print(list)" + ] }, { "attachments": {}, @@ -138,10 +215,22 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Madrid', 'Buenos Aires', 'Brazilia', 'Guajira', 'Madrid', 'Madrid', 'Congo', 'hola', 'mundo', 'cuel']\n" + ] + } + ], + "source": [ + "list2 = [\"hola\", \"mundo\",\"cuel\"]\n", + "list.extend(list2)\n", + "print(list)" + ] }, { "attachments": {}, @@ -153,10 +242,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "6\n" + ] + } + ], + "source": [ + "print(list.index(\"Congo\"))" + ] }, { "attachments": {}, @@ -168,10 +267,24 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "ename": "ValueError", + "evalue": "'Sin ciudad' is not in list", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[1;32mIn[18], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28;43mlist\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mindex\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mSin ciudad\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m)\n", + "\u001b[1;31mValueError\u001b[0m: 'Sin ciudad' is not in list" + ] + } + ], + "source": [ + "print(list.index(\"Sin ciudad\")) #Genera un error" + ] }, { "attachments": {}, @@ -183,10 +296,12 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "list.remove(\"Madrid\")" + ] }, { "attachments": {}, @@ -198,10 +313,24 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "ename": "ValueError", + "evalue": "list.remove(x): x not in list", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[1;32mIn[21], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28;43mlist\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mremove\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mMadrid2\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n", + "\u001b[1;31mValueError\u001b[0m: list.remove(x): x not in list" + ] + } + ], + "source": [ + "list.remove(\"Madrid2\") #genera un error" + ] }, { "attachments": {}, @@ -213,10 +342,21 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "cuel\n" + ] + } + ], + "source": [ + "\n", + "print(list.pop())" + ] }, { "attachments": {}, @@ -228,10 +368,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Buenos Aires', 'Brazilia', 'Guajira', 'Madrid', 'Madrid', 'Congo', 'hola', 'mundo', 'Buenos Aires', 'Brazilia', 'Guajira', 'Madrid', 'Madrid', 'Congo', 'hola', 'mundo', 'Buenos Aires', 'Brazilia', 'Guajira', 'Madrid', 'Madrid', 'Congo', 'hola', 'mundo', 'Buenos Aires', 'Brazilia', 'Guajira', 'Madrid', 'Madrid', 'Congo', 'hola', 'mundo']\n" + ] + } + ], + "source": [ + "print(list*4)" + ] }, { "attachments": {}, @@ -243,10 +393,21 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + } + ], + "source": [ + "tup = (1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)\n", + "print(type(tup))" + ] }, { "attachments": {}, @@ -258,10 +419,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(6, 7, 8)\n" + ] + } + ], + "source": [ + "print(tup[10:16])\n" + ] }, { "attachments": {}, @@ -273,10 +444,22 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "False\n", + "False\n" + ] + } + ], + "source": [ + "print(20 in tup)\n", + "print(30 in tup)" + ] }, { "attachments": {}, @@ -288,10 +471,12 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 34, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "list.append(\"Paris\")" + ] }, { "attachments": {}, @@ -303,10 +488,23 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 35, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "list.count(\"madrid\")\n" + ] }, { "attachments": {}, @@ -318,10 +516,26 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 49, + "metadata": {}, + "outputs": [ + { + "ename": "TypeError", + "evalue": "'list' object is not callable", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[1;32mIn[49], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m lis \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mlist\u001b[39m\n\u001b[1;32m----> 2\u001b[0m aux \u001b[38;5;241m=\u001b[39m \u001b[43mlis\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtup\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(aux)\n", + "\u001b[1;31mTypeError\u001b[0m: 'list' object is not callable" + ] + } + ], + "source": [ + "lis = list\n", + "aux = lis(tup)\n", + "print(aux)" + ] }, { "attachments": {}, @@ -333,10 +547,23 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(1, 2, 3, 5, 3, 6, 5, 7, 6, 7, 6, 7, 8)" + ] + }, + "execution_count": 46, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "tup" + ] }, { "attachments": {}, @@ -348,10 +575,12 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 51, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "dic = {\"Buenos Aires\",\"Madrid\",\"España\"}" + ] }, { "attachments": {}, @@ -363,10 +592,24 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'dic' 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(\u001b[43mdic\u001b[49m)\n", + "\u001b[1;31mNameError\u001b[0m: name 'dic' is not defined" + ] + } + ], + "source": [ + "print(dic.keys())" + ] }, { "attachments": {}, @@ -403,7 +646,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.12.2" } }, "nbformat": 4, From 292e79f8eac304d06ed3de36f383dc6d486a1f4e Mon Sep 17 00:00:00 2001 From: Ariel M Diaz Date: Thu, 23 May 2024 21:26:25 -0300 Subject: [PATCH 4/5] Done M06 --- .../Prep_Course_Homework_05.ipynb | 45 +- .../Prep_Course_Homework_06.ipynb | 485 +++++++++++++++--- .../Prep_Course_Homework_06.py | 24 +- 3 files changed, 472 insertions(+), 82 deletions(-) diff --git a/M05_estructuradedatos/Prep_Course_Homework_05.ipynb b/M05_estructuradedatos/Prep_Course_Homework_05.ipynb index de5aca924..a99a1ec7f 100644 --- a/M05_estructuradedatos/Prep_Course_Homework_05.ipynb +++ b/M05_estructuradedatos/Prep_Course_Homework_05.ipynb @@ -575,11 +575,20 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 10, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + } + ], "source": [ - "dic = {\"Buenos Aires\",\"Madrid\",\"España\"}" + "dic = {\"City\":[\"Buenos Aires\",\"Madrid\",\"España\"]}\n", + "print(type(dic))" ] }, { @@ -592,18 +601,14 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 12, "metadata": {}, "outputs": [ { - "ename": "NameError", - "evalue": "name 'dic' 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(\u001b[43mdic\u001b[49m)\n", - "\u001b[1;31mNameError\u001b[0m: name 'dic' is not defined" + "name": "stdout", + "output_type": "stream", + "text": [ + "dict_keys(['City'])\n" ] } ], @@ -621,10 +626,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Buenos Aires', 'Madrid', 'España']\n" + ] + } + ], + "source": [ + "print(dic[\"City\"])" + ] } ], "metadata": { diff --git a/M06_iterablesiteradores/Prep_Course_Homework_06.ipynb b/M06_iterablesiteradores/Prep_Course_Homework_06.ipynb index 75d6c18b1..c5e73f6c2 100644 --- a/M06_iterablesiteradores/Prep_Course_Homework_06.ipynb +++ b/M06_iterablesiteradores/Prep_Course_Homework_06.ipynb @@ -18,10 +18,27 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[-15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1]\n" + ] + } + ], + "source": [ + "lis = []\n", + "i=-15\n", + "while(i <= -1):\n", + " lis.append(i)\n", + " i+=1\n", + " \n", + "print(lis)\n", + " " + ] }, { "attachments": {}, @@ -33,10 +50,30 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-14\n", + "-12\n", + "-10\n", + "-8\n", + "-6\n", + "-4\n", + "-2\n" + ] + } + ], + "source": [ + "i=0\n", + "while(i\n", + "Salta\n", + "Argentina\n", + "2024\n" + ] + } + ], + "source": [ + "dic ={\"ciudad\":\"Salta\",\"Pais\":\"Argentina\",\"año\":2024}\n", + "\n", + "for i in dic:\n", + " print(dic[i])" + ] }, { "attachments": {}, @@ -195,10 +403,89 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "H\n", + "o\n", + "l\n", + "a\n", + " \n", + "M\n", + "u\n", + "n\n", + "d\n", + "o\n", + ".\n", + " \n", + "E\n", + "s\n", + "t\n", + "o\n", + " \n", + "e\n", + "s\n", + " \n", + "u\n", + "n\n", + "a\n", + " \n", + "p\n", + "r\n", + "a\n", + "c\n", + "t\n", + "i\n", + "c\n", + "a\n", + " \n", + "d\n", + "e\n", + "l\n", + " \n", + "l\n", + "e\n", + "n\n", + "g\n", + "u\n", + "a\n", + "j\n", + "e\n", + " \n", + "d\n", + "e\n", + " \n", + "p\n", + "r\n", + "o\n", + "g\n", + "r\n", + "a\n", + "m\n", + "a\n", + "c\n", + "i\n", + "ó\n", + "n\n", + " \n", + "P\n", + "y\n", + "t\n", + "h\n", + "o\n", + "n\n" + ] + } + ], + "source": [ + "cadena = list(cadena)\n", + "for i in cadena:\n", + " print(i)" + ] }, { "attachments": {}, @@ -210,10 +497,22 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + } + ], + "source": [ + "Letras = \"Todo empieza y termina por una razon\"\n", + "tupList = zip(cadena,list(Letras))\n", + "print(tupList)" + ] }, { "attachments": {}, @@ -226,10 +525,28 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 28, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + } + ], + "source": [ + "lis = [18,21,29,32,35,42,56,60,63,71,84,90,91,100]\n", + "def div7(lis):\n", + " vector = []\n", + " for i in lis:\n", + " if(i % 7 == 0):\n", + " vector.append(i)\n", + " return vector\n", + "\n", + "print(div7(lis))" + ] }, { "attachments": {}, @@ -242,10 +559,29 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "12\n" + ] + } + ], + "source": [ + "lis = [[1,2,3,4],'rojo','verde',[True,False,False],['uno','dos','tres']]\n", + "def countList(list_element):\n", + " n = 0\n", + " for i in list_element:\n", + " if(type(i)==list):\n", + " n += len(i)\n", + " else:\n", + " n+=1\n", + " return n \n", + "print(countList(lis))" + ] }, { "attachments": {}, @@ -257,10 +593,29 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "execution_count": 36, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[1, 2, 3, 4], ['rojo'], ['verde'], [True, False, False], ['uno', 'dos', 'tres']]\n" + ] + } + ], + "source": [ + "def convertList(list_element):\n", + " vector = []\n", + " for i in list_element:\n", + " if(type(i)== list):\n", + " vector.append(i)\n", + " else:\n", + " vector.append([i])\n", + " return vector\n", + "\n", + "print(convertList(lis)) " + ] } ], "metadata": { @@ -282,7 +637,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.12.2" } }, "nbformat": 4, diff --git a/M06_iterablesiteradores/Prep_Course_Homework_06.py b/M06_iterablesiteradores/Prep_Course_Homework_06.py index 85add52ab..cbb67777d 100644 --- a/M06_iterablesiteradores/Prep_Course_Homework_06.py +++ b/M06_iterablesiteradores/Prep_Course_Homework_06.py @@ -22,7 +22,10 @@ # 3) Resolver el punto anterior sin utilizar un ciclo while # In[4]: - +forlis = [2,34,6,3,6,8] +for i in forlis: + if((i%2)==0): + print(i) @@ -44,7 +47,11 @@ # 6) Dada la siguiente lista de números enteros entre 1 y 20, crear un ciclo donde se completen los valores faltantes: lista = [1,2,5,7,8,10,13,14,15,17,20] # In[10]: - +lista = [1,2,5,7,8,10,13,14,15,17,20] +while(i <=20): + if(i in lista): + lista.append(i) +print(lista) @@ -93,6 +100,19 @@ # cadena = 'Hola Mundo. Esto es una practica del lenguaje de programación Python' # In[39]: +cadena = 'Hola Mundo. Esto es una practica del lenguaje de programación Python' +def findText(cadena, search): + pos = [] + i = 0 + while(i != -1) : + i = cadena.find(search,i)+1 + #print(i) + if (i == 0): + break + pos.append(i) + return pos + +print(findText(cadena, "n")) From 1efe9f993ed66e0f5b027daa0f3d8635daa27a6c Mon Sep 17 00:00:00 2001 From: Ariel M Diaz Date: Fri, 24 May 2024 17:48:02 -0300 Subject: [PATCH 5/5] M07 --- M07_funciones/Prep_Course_Homework_07.ipynb | 138 ++++++++++++++++++-- 1 file changed, 126 insertions(+), 12 deletions(-) diff --git a/M07_funciones/Prep_Course_Homework_07.ipynb b/M07_funciones/Prep_Course_Homework_07.ipynb index dc6c4e40d..d9541ea50 100644 --- a/M07_funciones/Prep_Course_Homework_07.ipynb +++ b/M07_funciones/Prep_Course_Homework_07.ipynb @@ -18,10 +18,32 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "False\n" + ] + } + ], + "source": [ + "def is_prime(num=0):\n", + " i=2\n", + " n=num//2\n", + " while(i