"<h1><center>Tópicos Avanzados de Programación</center></h1>\n",
"\n",
"# 1. Python \n",
"## 1.1 Introduccion"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Python fue creado en 1991 por Guido van Rossum, con la filosofia de crear codigo legible, por lo que la identacion es obligatoria. Su desarrollo esta administrado por **Python Software Foundation** (python.org).\n",
"\n",
"\n",
"Caracteristicas:\n",
"* Alto Nivel\n",
"* Interpretado (Se ejecuta sin compilación previa)\n",
"* Tipificación Dinamica (Se realiza durante en tiempo de ejecución)\n",
"* Multiparadigma\n",
"* Interactivo (con ipython)\n"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"int"
]
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type (8)"
]
},
{
"cell_type": "code",
"execution_count": 75,
"metadata": {},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "can't use starred expression here (cell_name, line 6)",
"output_type": "error",
"traceback": [
"\u001b[0;36m File \u001b[0;32m\"cell_name\"\u001b[0;36m, line \u001b[0;32m6\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m can't use starred expression here\n"
]
}
],
"source": [
"## 1.2 Tipos de Datos\n",
"#### Numericos\n",
"* int\n",
"* float\n",
"* complex"
]
},
{
"cell_type": "code",
"execution_count": 74,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"float"
]
},
"execution_count": 74,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type (1.)"
]
},
{
"cell_type": "code",
"execution_count": 73,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"complex"
]
},
"execution_count": 73,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type ((1+2j))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Secuencias\n",
"* list\n",
"* tuple \n",
"* range\n"
]
},
{
"cell_type": "code",
"execution_count": 131,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"list"
]
},
"execution_count": 131,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type([1,2,3])"
]
},
{
"cell_type": "code",
"execution_count": 49,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tuple"
]
},
"execution_count": 49,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type((1,2))"
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"range"
]
},
"execution_count": 50,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type(range(1))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Texto\n",
"* str\n"
]
},
{
"cell_type": "code",
"execution_count": 51,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"str"
]
},
"execution_count": 51,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type(\"Hola\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Mapeo\n",
"* dict"
]
},
{
"cell_type": "code",
"execution_count": 52,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"dict"
]
},
"execution_count": 52,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type({\"mensaje\":\"hola mundo\"})"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Conjuntos\n",
"* set\n",
"* frozenset"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"set([1,2,3,1,5,2,6])\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1.2 Operadores\n",
"### Comparación \n",
"| Simbolo | Operador |\n",
"|---------|----------|\n",
"| < | menor que |\n",
"| <= | Menor o igual que |\n",
"| >\t| Mayor que |Mayor o igual que | \n",
"| == | Igual |\n",
"| != | Desigual |\n",
"| is | Identidad de Objetos |\n",
"| is not | Identidad Negada de Objetos|\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 76,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 76,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"6 < 9"
]
},
{
"cell_type": "code",
"execution_count": 54,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 54,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"6 > 9"
]
},
{
"cell_type": "code",
"execution_count": 55,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 55,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"6 == 9"
]
},
{
"cell_type": "code",
"execution_count": 56,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 56,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"6 != 9"
]
},
{
"cell_type": "code",
"execution_count": 57,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 57,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"6 is float(6)\n"
]
},
{
"cell_type": "code",
"execution_count": 58,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 58,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"6 is int(6)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Operaciones\n",
"| Operacion\t| Result |\n",
"|-----------|--------|\n",
"| x + y\t| Suma |\n",
"| x - y\t| Resta |\n",
"| x * y\t| Multiplicacion |\n",
"| x / y\t| Division |\n",
"| x // y | Division (Parte entera) |\n",
"| x % y\t| Modulo|\n",
"| x ** y | x a la potencia y |\n",
"\n",
"### Operador a nivel de bits\n",
"| Operation | Result |\n",
"|-----------|--------|\n",
"| x | y\t| x OR y |\n",
"| x ^ y\t| x XOR y |\n",
"| x & y\t| x AND y |\n",
"| x << n | x desplazado n bits a la izquierda |\n",
"| x >> n | x desplazado n bits a la derecha |\n",
"| ~x | x Negado |\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1.3 Control de Flujo\n",
"Las estructuruas de control de flijo permiten modificar el flujo de ejecución de las instrucciones de un programa mediante el valor binario de una condicion. Python cuenta con las siguientes estructuras de control:\n",
"\n",
"* if, elif\n",
"* else\n",
"* for\n",
"* while\n",
"* continue\n",
"* break\n",
"* pass\n",
"* try, exeption\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 77,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"True\n"
]
}
],
"source": [
"if True:\n",
" print(\"True\")\n",
"else:\n",
" print(\"False\")"
]
},
{
"cell_type": "code",
"execution_count": 78,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0\n",
"1\n",
"2\n",
"3\n",
"4\n"
]
}
],
"source": [
"for i in range(5):\n",
" print(i)"
]
},
{
"cell_type": "code",
"execution_count": 84,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Vacio\n"
]
}
],
"source": [
"for i in range(0):\n",
" print(i)\n",
"else:\n",
" print(\"Vacio\")"
]
},
{
"cell_type": "code",
"execution_count": 142,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\n",
"2\n",
"3\n",
"4\n",
"5\n"
]
}
],
"source": [
"i = 0\n",
"while i < 5:\n",
" i+=1\n",
" print(i)"
]
},
{
"cell_type": "code",
"execution_count": 85,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0\n",
"1\n",
"3\n",
"4\n"
]
}
],
"source": [
"for i in range(5):\n",
" if(i==2):\n",
" continue\n",
" print(i)"
]
},
{
"cell_type": "code",
"execution_count": 88,
"metadata": {},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "'break' outside loop (cell_name, line 6)",
"output_type": "error",
"traceback": [
"\u001b[0;36m File \u001b[0;32m\"cell_name\"\u001b[0;36m, line \u001b[0;32m6\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m 'break' outside loop\n"
]
}
],
"source": [
"# for i in range(5):\n",
" if(i==2):\n",
" break\n",
" print(i)"
]
},
{
"cell_type": "code",
"execution_count": 70,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0\n",
"1\n",
"2\n",
"3\n",
"4\n"
]
}
],
"source": [
"for i in range(5):\n",
" if(i==2):\n",
" pass\n",
" print(i)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Todos los objetos de python son considerados verdaders (True) exepto los siguintes:\n",
"* Constantes definidas como: None o False.\n",
"* Cero de cualquier tipo numerico: 0, 0.0, 0j, Decimal(0), Fraction(0, 1)\n",
"Una función es un conjunto de setencias que pueden ser invocadas varias veces durante la ejecución de un programa. Permiten minimizar el codigo, amuentar su legibilidad y permiten reutilizar código. En python las funciones son definida por la palabra reservada **def**. \n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 95,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hello World\n"
]
}
],
"source": [
"def HelloWorld():\n",
" print(\"Hello World\")\n",
"\n",
"HelloWorld()\n"
]
},
{
"cell_type": "code",
"execution_count": 68,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.5\n",
"0.6666666666666666\n",
"1.0\n",
"2.0\n",
"ERROR\n"
]
}
],
"source": [
"for i in reversed(range(5)):\n",
" try:\n",
" print(2/i)\n",
" except:\n",
" print(\"ERROR\")\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.4.1 Parametros\n",
"La funciones pueden aceptar arguentos de entrada y devoler resultados."
]
},
{
"cell_type": "code",
"execution_count": 67,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hello Mario\n"
]
}
],
"source": [
"def Hello(name):\n",
" print(\"Hello \"+name)\n",
"Hello(\"Mario\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.4.2 Parametros Opcionales\n",
"Las funciones tampien pueden aceptar parametros opcionales, los cuales toman en valor indicado por defecto si no son pasados a la funcion."
]
},
{
"cell_type": "code",
"execution_count": 66,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hello Mario!!!\n",
"Hello Mario?\n",
"Hello Mario!\n",
"Hello Alex!!\n"
]
},
{
"data": {
"text/plain": [
"[1]"
]
},
"execution_count": 66,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def Hello(name, x=\"!!!\"):\n",
" print(\"Hello \" + name + x)\n",
"Hello(\"Mario\")\n",
"Hello(\"Mario\",\"?\")\n",
"Hello(x=\"!\", name=\"Mario\")\n",
"p = {\"name\":\"Alex\", \"x\":\"!!\"}\n",
"Hello(**p)\n",
"[1,]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.4.3 Desempaquetado"
]
},
{
"cell_type": "code",
"execution_count": 130,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 1 2\n",
"0 4 5\n",
"[6, 7, 8] 1 2\n",
"6 7 8\n",
"{'a': 9, 'b': 10, 'c': 11} 1 2\n",
"9 10 11\n"
]
}
],
"source": [
"def unpack(a,b=1,c=2):\n",
" print(a,b,c)\n",
"\n",
"l = [6,7,8] \n",
"d = {\"a\":9,\"b\":10,\"c\":11} \n",
"unpack(0)\n",
"unpack(0, 4, 5)\n",
"unpack(l)\n",
"unpack(*l)\n",
"unpack(d)\n",
"unpack(**d)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1.5 Ejercicios\n",
"### 1.5.1 Imprimir todos los numeros pares entre 0 y 20 usando *for* o *while*."
]
},
{
"cell_type": "code",
"execution_count": 132,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0 2 4 6 8 10 12 14 16 18 20 \n"
]
}
],
"source": [
"pares=0\n",
"h=''\n",
"while pares <= 20:\n",
" if pares %2 == 0:\n",
" h += ' %i ' % pares\n",
" pares += 1\n",
"print (h)\n",
" "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.5.2 Imprimir todos los numeros mayores a 10 de la lista A"
]
},
{
"cell_type": "code",
"execution_count": 151,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"13\n",
"21\n",
"34\n",
"55\n",
"89\n"
]
}
],
"source": [
"A = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]\n",
"for h in range(len(A)):\n",
" if A[h]>10:\n",
" print (A[h])\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.5.3 Dadas dos listas A y B, obten una lista con sus elementos comunes (A∩B)."
"### 1.5.4 Pregunta al usario cuantos numeros de la secuancia Fibonacci quiere calcular y escribe una funcion que calcule la secuencia e imprima el resultado."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Cuantos numeros de secuencia de fibonacci desea\n",
"print (\"Cuantos numeros de secuencia de fibonacci desea\")\n",
"n= int (input ())\n",
"while a < n:\n",
" print (a, end=' ')\n",
" a,b = b, a + b\n",
"print ()\n",
"fibonacci(n)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.5.5 Escribe una funcion que sume todos los uneros en una lista."
]
},
{
"cell_type": "code",
"execution_count": 190,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20\n"
]
}
],
"source": [
"a= [8, 2, 3, 0, 7]\n",
"def sumalista(b):\n",
" s = 0\n",
" for i in b:\n",
" s = s + i\n",
" return s\n",
"\n",
"print (sumalista(a))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.5.6 Escribe una funcion que tome una lista y regrese los elementos unicos en la lista.\n"
]
},
{
"cell_type": "code",
"execution_count": 196,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1, 2, 3, 4, 5]\n"
]
}
],
"source": [
"a = [1,2,2,3,3,3,3,4,5,5]\n",
"Nueva=[]\n",
"for i in a :\n",
" if i not in Nueva:\n",
" Nueva.append(i)\n",
"print (Nueva)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.5.7 Escribe una funcion que indique si un numero es o no perfecto.\n",
"[Wikipedia:](https://es.wikipedia.org/wiki/N%C3%BAmero_perfecto) *Un número perfecto es un número natural que es igual a la suma de sus divisores propios positivos. Dicho de otra forma, un número perfecto es aquel que es amigo de sí mismo.\n",
"Así, 6 es un número perfecto porque sus divisores propios son 1, 2 y 3; y 6 = 1 + 2 + 3. Los siguientes números perfectos son 28, 496 y 8128.*\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 130,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Numero a comprobar:6\n"
]
}
],
"source": [
"def NP(x):\n",
" suma=0\n",
" for i in range(1,x):\n",
" if (x%i== 0):\n",
" s +=i\n",
" \n",
" if x== suma:\n",
" return true\n",
" else:\n",
" return false\n",
"x = int(input (\"Numero a comprobar:\"))\n",
"def NP(n):\n",
" for i in range(n):\n",
" if (NP(i+1)):\n",
" print (\"El numero perfecto es \"% (i+1)\n",
" else:\n",
" print (\"No es numero perfecto es \"% (i+1))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.5.8 Escribe una funcion que imprima las prieras *n* filas del triangulo de Pascal.\n",
"El triángulo de Pascal es un triángulo numérico con números dispuestos en filas escalonadas de manera tal que:\n",
"$a_{nr}=\\frac{n!}{r!(n-r)!}=\\binom{n}{r}$\n"
]
},
{
"cell_type": "code",
"execution_count": 127,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Indica el numero de filas:12\n",
"1\n",
"\n",
"\n",
"1\n",
"\n",
"\n",
"1.0\n",
"\n",
"\n",
"1\n",
"\n",
"\n",
"2.0\n",
"\n",
"\n",
"1.0\n",
"\n",
"\n",
"1\n",
"\n",
"\n",
"3.0\n",
"\n",
"\n",
"3.0\n",
"\n",
"\n",
"1.0\n",
"\n",
"\n",
"1\n",
"\n",
"\n",
"4.0\n",
"\n",
"\n",
"6.0\n",
"\n",
"\n",
"4.0\n",
"\n",
"\n",
"1.0\n",
"\n",
"\n",
"1\n",
"\n",
"\n",
"5.0\n",
"\n",
"\n",
"10.0\n",
"\n",
"\n",
"10.0\n",
"\n",
"\n",
"5.0\n",
"\n",
"\n",
"1.0\n",
"\n",
"\n",
"1\n",
"\n",
"\n",
"6.0\n",
"\n",
"\n",
"15.0\n",
"\n",
"\n",
"20.0\n",
"\n",
"\n",
"15.0\n",
"\n",
"\n",
"6.0\n",
"\n",
"\n",
"1.0\n",
"\n",
"\n",
"1\n",
"\n",
"\n",
"7.0\n",
"\n",
"\n",
"21.0\n",
"\n",
"\n",
"35.0\n",
"\n",
"\n",
"35.0\n",
"\n",
"\n",
"21.0\n",
"\n",
"\n",
"7.0\n",
"\n",
"\n",
"1.0\n",
"\n",
"\n",
"1\n",
"\n",
"\n",
"8.0\n",
"\n",
"\n",
"28.0\n",
"\n",
"\n",
"56.0\n",
"\n",
"\n",
"70.0\n",
"\n",
"\n",
"56.0\n",
"\n",
"\n",
"28.0\n",
"\n",
"\n",
"8.0\n",
"\n",
"\n",
"1.0\n",
"\n",
"\n",
"1\n",
"\n",
"\n",
"9.0\n",
"\n",
"\n",
"36.0\n",
"\n",
"\n",
"84.0\n",
"\n",
"\n",
"126.0\n",
"\n",
"\n",
"126.0\n",
"\n",
"\n",
"84.0\n",
"\n",
"\n",
"36.0\n",
"\n",
"\n",
"9.0\n",
"\n",
"\n",
"1.0\n",
"\n",
"\n",
"1\n",
"\n",
"\n",
"10.0\n",
"\n",
"\n",
"45.0\n",
"\n",
"\n",
"120.0\n",
"\n",
"\n",
"210.0\n",
"\n",
"\n",
"252.0\n",
"\n",
"\n",
"210.0\n",
"\n",
"\n",
"120.0\n",
"\n",
"\n",
"45.0\n",
"\n",
"\n",
"10.0\n",
"\n",
"\n",
"1.0\n",
"\n",
"\n",
"1\n",
"\n",
"\n",
"11.0\n",
"\n",
"\n",
"55.0\n",
"\n",
"\n",
"165.0\n",
"\n",
"\n",
"330.0\n",
"\n",
"\n",
"462.0\n",
"\n",
"\n",
"462.0\n",
"\n",
"\n",
"330.0\n",
"\n",
"\n",
"165.0\n",
"\n",
"\n",
"55.0\n",
"\n",
"\n",
"11.0\n",
"\n",
"\n",
"1.0\n",
"\n",
"\n",
"1\n",
"\n",
"\n",
"12.0\n",
"\n",
"\n",
"66.0\n",
"\n",
"\n",
"220.0\n",
"\n",
"\n",
"495.0\n",
"\n",
"\n",
"792.0\n",
"\n",
"\n",
"924.0\n",
"\n",
"\n",
"792.0\n",
"\n",
"\n",
"495.0\n",
"\n",
"\n",
"220.0\n",
"\n",
"\n",
"66.0\n",
"\n",
"\n",
"12.0\n",
"\n",
"\n",
"1.0\n",
"\n",
"\n"
]
}
],
"source": [
"def pascal(n):\n",
" pass\n",
"n= int(input(\"Indica el numero de filas:\"))\n",
"pascal(numero)\n",
"for i in range(0,n+1):\n",
" n=1\n",
" for j in range(0,i+1):\n",
" print (str(n)+ \"\")\n",
" n=n*(i-j)/(j+1)\n",
" print (\"\\n\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"### 1.5.9 Escribe una funcion que indique si una frase es un panagrama.\n",
"[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": 133,
"metadata": {},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "unexpected character after line continuation character (<ipython-input-133-702121710aea>, line 1)",
"output_type": "error",
"traceback": [
"\u001b[0;36m File \u001b[0;32m\"<ipython-input-133-702121710aea>\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m tex=input(\"la frase\"\\n''\\n)\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m unexpected character after line continuation character\n"
]
}
],
"source": [
"tex=input(\"la frase\"\\n''\\n)\n",
"abecedario=list \n",
"(\"abcdefghijklmnopqrstuvwxyz\")\n",
"frase=tex.lower()\n",
"i=0\n",
"while i<len(abecedario):\n",
" if abecedario[i] in frase:\n",
" abecedario.pop(i)\n",
" else\n",
" i=len(abecedario)\n",
" if len(abecedario)!=0:\n",
" print('\\n'\"no es un programa\")\n",
" else:\n",
" print('\\n'\"Es un programa\")\n",
" "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.5.10 Escribe un programa que imprima el siguiente un **for** anidado.\n",