diff --git a/Ejercicio1.ipynb b/Ejercicio1.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..446f4619682d2f1f2fee7db2eaaeaa02ab0331a8 --- /dev/null +++ b/Ejercicio1.ipynb @@ -0,0 +1,91 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "w-d-z-a\n", + "a-d-w-z\n" + ] + } + ], + "source": [ + "i=input()\n", + "\n", + "def orden(f):\n", + " x='-'.join(sorted(set(f.split('-'))))\n", + " print(x)\n", + "\n", + "orden(i)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": {}, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'da' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m<ipython-input-51-2bc23ea85970>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtuple\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mda\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mNameError\u001b[0m: name 'da' is not defined" + ] + } + ], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.7.3" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/Ejercicio2.ipynb b/Ejercicio2.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..a74b17c1f42a0e25d46de4bdf38abd911ff6c59e --- /dev/null +++ b/Ejercicio2.ipynb @@ -0,0 +1,212 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import math" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1.0" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "def combinatoria(n,k): \n", + " return math.factorial(n)/(math.factorial(k)*math.factorial(n-k))\n", + "combinatoria(5,0)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 5, 10, 10, 5, 1]" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "def Pascal(n):\n", + " x=[]\n", + " for k in range(0,n+1):\n", + " x.append(int(combinatoria(n,k)))\n", + " return x\n", + "Pascal(5)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "def pasc(n):\n", + " if type(n)==type(3):\n", + " print(Pascal(n))\n", + " else :\n", + " print(\"Su numero ingresado no es entero\")" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Su numero ingresado no es entero\n" + ] + } + ], + "source": [ + "pasc(5.)" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "def pasc2(*args):\n", + " # list(args)\n", + "# print(type(args[0][2]))\n", + "# print(len(args[0]))\n", + " X=[]\n", + " for i in range(len(args[0])):\n", + " if type(args[0][i])==type(3):\n", + " X.append(Pascal(args[0][i]))\n", + "# print(X)\n", + " else :\n", + " print(f\"el numero en la posicion {i+1} no es entero\")\n", + " return 0\n", + " print(X)\n", + " \n", + " \n", + " \n", + " \n", + "\n", + " \n", + "\n", + "\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[1, 1], [1, 2, 1], [1, 3, 3, 1]]\n" + ] + } + ], + "source": [ + "pasc2([1,2,3])\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "range?\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.7.3" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/Ejercicio3.ipynb b/Ejercicio3.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..42640b8b65e3312940f3a3f9e488aa8efa9ad251 --- /dev/null +++ b/Ejercicio3.ipynb @@ -0,0 +1,142 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "mexico\n" + ] + } + ], + "source": [ + "juanpineda= {\n", + " 'nombre': 'JuanPineda',\n", + " 'apellido':'1',\n", + " 'pais': 'mexico',\n", + " 'residencia':'1',\n", + " 'edad':'1',\n", + " 'institucion':'colegio1',\n", + " 'hobbie':'1'\n", + "}\n", + "\n", + "\n", + "camilo={\n", + " 'nombre': 'Camilo',\n", + " 'apellido':'2',\n", + " 'pais':'mexico',\n", + " 'residencia':'2',\n", + " 'edad':'2',\n", + " 'institucion':'colegio1',\n", + " 'hobbie':'2'\n", + " \n", + "}\n", + "\n", + "compas={\n", + " 'juanpineda': juanpineda,\n", + " 'camilo':camilo\n", + "}\n", + "print(compas['juanpineda']['pais'])" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "nombre apellido pais residencia edad institucion hobbie\n", + "JuanPineda 1 mexico 1 1 colegio1 1\n", + "Camilo 2 mexico 2 2 colegio1 2\n" + ] + } + ], + "source": [ + "#Tabla Organizada\n", + "nombres=['juanpineda','camilo']\n", + "def Orden(compas,b):\n", + " print(' '.join(list((compas['camilo'].keys()))))\n", + " for i in nombres:\n", + "# print(type(i))\n", + " if compas[i]['pais']==b:\n", + " \n", + " print(' '.join(list((compas[i].values()))))\n", + "\n", + " \n", + " \n", + " \n", + "Orden(compas,'mexico')" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1.5\n" + ] + } + ], + "source": [ + "#Media de la edad\n", + "x=0\n", + "for i in nombres:\n", + " x+=int(compas[i]['edad'])/len(nombres)\n", + "print(x)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'colegio1'}\n" + ] + } + ], + "source": [ + "\n", + "#Instituciones\n", + "s=[]\n", + "for i in nombres:\n", + " s.append(compas[i]['institucion'])\n", + "print(set(s))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +}