Entrega Final

parent 8340fc7f
...@@ -690,7 +690,7 @@ ...@@ -690,7 +690,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 26, "execution_count": 214,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -702,16 +702,6 @@ ...@@ -702,16 +702,6 @@
"Hello Mario!\n", "Hello Mario!\n",
"Hello Alex!!\n" "Hello Alex!!\n"
] ]
},
{
"data": {
"text/plain": [
"[1]"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
} }
], ],
"source": [ "source": [
...@@ -721,8 +711,7 @@ ...@@ -721,8 +711,7 @@
"Hello(\"Mario\",\"?\")\n", "Hello(\"Mario\",\"?\")\n",
"Hello(x=\"!\", name=\"Mario\")\n", "Hello(x=\"!\", name=\"Mario\")\n",
"p = {\"name\":\"Alex\", \"x\":\"!!\"}\n", "p = {\"name\":\"Alex\", \"x\":\"!!\"}\n",
"Hello(**p)\n", "Hello(**p)"
"[1,]"
] ]
}, },
{ {
...@@ -734,7 +723,7 @@ ...@@ -734,7 +723,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 27, "execution_count": 213,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -745,7 +734,7 @@ ...@@ -745,7 +734,7 @@
"0 4 5\n", "0 4 5\n",
"[6, 7, 8] 1 2\n", "[6, 7, 8] 1 2\n",
"6 7 8\n", "6 7 8\n",
"{'a': 9, 'b': 10, 'c': 11} 1 2\n", "{'b': 10, 'a': 9, 'c': 11} 1 2\n",
"9 10 11\n" "9 10 11\n"
] ]
} }
...@@ -774,7 +763,7 @@ ...@@ -774,7 +763,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 31, "execution_count": 90,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -802,7 +791,7 @@ ...@@ -802,7 +791,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 40, "execution_count": 91,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -836,14 +825,14 @@ ...@@ -836,14 +825,14 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 73, "execution_count": 92,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"{34, 21, 55, 89}\n" "{1, 2, 3, 5, 8, 13}\n"
] ]
} }
], ],
...@@ -852,7 +841,7 @@ ...@@ -852,7 +841,7 @@
"b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]\n", "b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]\n",
"\n", "\n",
"coincide=[]\n", "coincide=[]\n",
"coincide=set(a).difference(b)\n", "coincide=set(a).intersection(b)\n",
"print(coincide)\n" "print(coincide)\n"
] ]
}, },
...@@ -865,12 +854,42 @@ ...@@ -865,12 +854,42 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 30, "execution_count": 93,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ingresa los N elementos de la secuencia de Fibonacci?\n",
": 10\n"
]
},
{
"data": {
"text/plain": [
"[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]"
]
},
"execution_count": 93,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [ "source": [
"def fibonacci(n):\n", "def fibonacci(n):\n",
" pass" " if n == 0:\n",
" return [0]\n",
" elif n == 1:\n",
" return [0, 1]\n",
" else:\n",
" listaF = fibonacci(n-1)\n",
" listaF.append(listaF[-1] + listaF[-2])\n",
" return listaF\n",
" \n",
"tamaño=int(input(\"Ingresa los N elementos de la secuencia de Fibonacci?\\n: \"))\n",
"tamaño=tamaño-1\n",
"fibonacci(tamaño)"
] ]
}, },
{ {
...@@ -882,7 +901,7 @@ ...@@ -882,7 +901,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 104, "execution_count": 97,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -891,7 +910,7 @@ ...@@ -891,7 +910,7 @@
"20" "20"
] ]
}, },
"execution_count": 104, "execution_count": 97,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
...@@ -917,11 +936,27 @@ ...@@ -917,11 +936,27 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 32, "execution_count": 98,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{1, 2, 3, 4, 5}\n"
]
}
],
"source": [ "source": [
"a = [1,2,2,3,3,3,3,4,5,5]" "a = [1,2,2,3,3,3,3,4,5,5]\n",
"\n",
"def unicos(lista):\n",
" norep=[]\n",
" norep=set(lista)\n",
" print(norep)\n",
"\n",
"unicos(a)\n",
" "
] ]
}, },
{ {
...@@ -934,23 +969,52 @@ ...@@ -934,23 +969,52 @@
"\n" "\n"
] ]
}, },
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Se probó con los numeros\n",
"* 28\n",
"* 496\n",
"* 8128\n",
"* 33 550 336\n",
"\n",
"Ya los otros jamás termino de cargar :)"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 34, "execution_count": 212,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Escribe un nuemero:8\n" "Ingresa tu numero\n",
": 6\n"
] ]
},
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 212,
"metadata": {},
"output_type": "execute_result"
} }
], ],
"source": [ "source": [
"def perfect(x):\n", "def perfect(n):\n",
" pass\n", " sum = 0\n",
"numero = input(\"Escribe un nuemero:\")\n", " for x in range(1, n):\n",
" if n % x == 0:\n",
" sum += x\n",
" return sum == n\n",
"\n",
"numero = int(input(\"Ingresa tu numero\\n: \"))\n",
"perfect(numero)" "perfect(numero)"
] ]
}, },
...@@ -966,16 +1030,124 @@ ...@@ -966,16 +1030,124 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 241,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Indica el numero de filas\n",
":5\n",
"[[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1], [1, 5, 10, 10, 5, 1]]\n"
]
}
],
"source": [ "source": [
"def pascal(n):\n", "def pascal(n):\n",
" pass\n", " lista = [[1],[1,1]]\n",
"numero = input(\"Indica el numero de filas:\")\n", " for i in range(1,n):\n",
" linea = [1]\n",
" for j in range(0,len(lista[i])-1):\n",
" #Suerte de Join\n",
" linea.extend([ lista[i][j] + lista[i][j+1] ])\n",
" linea += [1]\n",
" lista.append(linea) \n",
" print (lista)\n",
" \n",
"numero = int(input(\"Indica el numero de filas\\n:\"))\n",
"pascal(numero)" "pascal(numero)"
] ]
}, },
{
"cell_type": "code",
"execution_count": 247,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\n",
"1\n",
"2\n",
"[[1], [1, 1], [1, 2, 1]]\n",
"1\n",
"2\n",
"3\n",
"2\n",
"1\n",
"3\n",
"[[1], [1, 1], [1, 2, 1], [1, 3, 3, 1]]\n",
"1\n",
"3\n",
"4\n",
"3\n",
"3\n",
"6\n",
"3\n",
"1\n",
"4\n",
"[[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1]]\n",
"1\n",
"4\n",
"5\n",
"4\n",
"6\n",
"10\n",
"6\n",
"4\n",
"10\n",
"4\n",
"1\n",
"5\n",
"[[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1], [1, 5, 10, 10, 5, 1]]\n"
]
}
],
"source": [
"##Prueba (NO TENER EN CUENTA)\n",
"\n",
"def pascal(n):\n",
" lista = [[1],[1,1]]\n",
" for i in range(1,n):\n",
" linea = [1]\n",
" for j in range(0,len(lista[i])-1):\n",
" print(lista[i][j])\n",
" print(lista[i][j+1])\n",
" print(lista[i][j]+lista[i][j+1])\n",
" linea.extend([ lista[i][j] + lista[i][j+1] ])\n",
" linea += [1]\n",
" lista.append(linea)\n",
" print(lista)\n",
"pascal(5)"
]
},
{
"cell_type": "code",
"execution_count": 174,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{(3, 'three'), (2, 'two'), (1, 'one')}\n"
]
}
],
"source": [
"numberList = [1, 2, 3]\n",
"strList = ['one', 'two', 'three']\n",
"\n",
"# Two iterables are passed\n",
"result = zip(numberList, strList)\n",
"\n",
"# Converting itertor to set\n",
"resultSet = set(result)\n",
"print(resultSet)"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
...@@ -984,6 +1156,40 @@ ...@@ -984,6 +1156,40 @@
"[Wikipedia](https://es.wikipedia.org/wiki/Pangrama):Un pangrama (del griego: παν γραμμα, «todas las letras») o frase holoalfabética es un texto que usa todas las letras posibles del alfabeto de un idioma. " "[Wikipedia](https://es.wikipedia.org/wiki/Pangrama):Un pangrama (del griego: παν γραμμα, «todas las letras») o frase holoalfabética es un texto que usa todas las letras posibles del alfabeto de un idioma. "
] ]
}, },
{
"cell_type": "code",
"execution_count": 140,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ingrese su frase\n",
": abcdefghijklmnñopqrstuvwxz\n",
"abcdefghijklmnñopqrstuvwxz abcdefghijklmnñopqrstuvwxyz\n",
"No es pangrama :v\n"
]
}
],
"source": [
"def pangrama(Frase):\n",
" alfabeto = \"abcdefghijklmnñopqrstuvwxyz\"\n",
" letrasF = \"\"\n",
" for char in Frase:\n",
" if char in alfabeto:\n",
" letrasF += char\n",
" for char in alfabeto:\n",
" if char not in Frase:\n",
" print (letrasF, alfabeto)\n",
" return print(\"No es pangrama :v\")\n",
"\n",
" return print(\"Si es pangrama! :)\")\n",
"\n",
"Frase1 = str(input(\"Ingrese su frase\\n: \"))\n",
"pangrama(Frase1)"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
...@@ -1010,10 +1216,33 @@ ...@@ -1010,10 +1216,33 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 84,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
"source": [] {
"name": "stdout",
"output_type": "stream",
"text": [
"1\n",
"22\n",
"333\n",
"4444\n",
"55555\n",
"666666\n",
"7777777\n",
"88888888\n",
"999999999\n"
]
}
],
"source": [
"numeros=list(range(1,10))\n",
"numerosT=[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\"]\n",
"\n",
"for numT in numerosT:\n",
" print(numT*int(numT))\n",
" \n"
]
} }
], ],
"metadata": { "metadata": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment