Commit 3b5c1109 authored by Carlos David García Hernández's avatar Carlos David García Hernández

examen 1

parents ee35fc97 2b2c0d29
install.packages("car")
library(car)
install.packages("rgl")
q()
...@@ -251,7 +251,7 @@ ...@@ -251,7 +251,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 55, "execution_count": 2,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -307,6 +307,38 @@ ...@@ -307,6 +307,38 @@
"print(list(doublesG))" "print(list(doublesG))"
] ]
}, },
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Cuatos Fibonacci?: 6\n",
"0\n",
"1\n",
"1\n",
"2\n",
"3\n",
"5\n"
]
}
],
"source": [
"a = int(input('Cuatos Fibonacci?: '))\n",
"\n",
"def fib(n):\n",
" a, b = 0, 1\n",
" for _ in range(n):\n",
" yield a\n",
" a, b = b, a + b\n",
"\n",
"for n in fib(a):\n",
" print(n)"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
......
This diff is collapsed.
...@@ -894,7 +894,7 @@ ...@@ -894,7 +894,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 10,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -1360,6 +1360,74 @@ ...@@ -1360,6 +1360,74 @@
" \n", " \n",
"piramide()" "piramide()"
] ]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"wrote tarea2_ejercicios1.html\n"
]
}
],
"source": [
"%%bash\n",
"cd miModulo\n",
"pydoc -w tarea2_ejercicios1"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n",
"<html><head><title>Python: module tarea2_ejercicios1</title>\n",
"<meta charset=\"utf-8\">\n",
"</head><body bgcolor=\"#f0f0f8\">\n",
"\n",
"<table width=\"100%\" cellspacing=0 cellpadding=2 border=0 summary=\"heading\">\n",
"<tr bgcolor=\"#7799ee\">\n",
"<td valign=bottom>&nbsp;<br>\n",
"<font color=\"#ffffff\" face=\"helvetica, arial\">&nbsp;<br><big><big><strong>tarea2_ejercicios1</strong></big></big></font></td\n",
"><td align=right valign=bottom\n",
"><font color=\"#ffffff\" face=\"helvetica, arial\"><a href=\".\">index</a><br><a href=\"file:/home/carlosgarcia8/repos/tap1012/miModulo/tarea2_ejercicios1.py\">/home/carlosgarcia8/repos/tap1012/miModulo/tarea2_ejercicios1.py</a></font></td></tr></table>\n",
" <p><tt>Documentación&nbsp;para&nbsp;la&nbsp;segunda&nbsp;tarea&nbsp;(ejercicios&nbsp;1)&nbsp;de&nbsp;la&nbsp;materia&nbsp;de&nbsp;Tópicos&nbsp;Avanzados&nbsp;de&nbsp;Programación.<br>\n",
"Maestría&nbsp;GeoInteligencia&nbsp;Computacional&nbsp;a&nbsp;27&nbsp;de&nbsp;Enero&nbsp;del&nbsp;2019.</tt></p>\n",
"<p>\n",
"<table width=\"100%\" cellspacing=0 cellpadding=2 border=0 summary=\"section\">\n",
"<tr bgcolor=\"#eeaa77\">\n",
"<td colspan=3 valign=bottom>&nbsp;<br>\n",
"<font color=\"#ffffff\" face=\"helvetica, arial\"><big><strong>Functions</strong></big></font></td></tr>\n",
" \n",
"<tr><td bgcolor=\"#eeaa77\"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>\n",
"<td width=\"100%\"><dl><dt><a name=\"-coincide\"><strong>coincide</strong></a>(l1, l2)</dt><dd><tt>Función&nbsp;que&nbsp;devuelve&nbsp;todos&nbsp;los&nbsp;elementos&nbsp;coincidentes&nbsp;de&nbsp;un&nbsp;par&nbsp;de&nbsp;listas&nbsp;que&nbsp;el&nbsp;usuario&nbsp;pase&nbsp;como&nbsp;argumento</tt></dd></dl>\n",
" <dl><dt><a name=\"-numerMay\"><strong>numerMay</strong></a>(l1)</dt><dd><tt>Función&nbsp;que&nbsp;devuelve&nbsp;los&nbsp;números&nbsp;estrictamente&nbsp;mayores&nbsp;a&nbsp;10&nbsp;de&nbsp;una&nbsp;lista&nbsp;que&nbsp;el&nbsp;usuario&nbsp;pase&nbsp;como&nbsp;argumento</tt></dd></dl>\n",
" <dl><dt><a name=\"-numerPar\"><strong>numerPar</strong></a>()</dt><dd><tt>Función&nbsp;que&nbsp;devuelve&nbsp;los&nbsp;números&nbsp;pares&nbsp;de&nbsp;una&nbsp;lista&nbsp;que&nbsp;el&nbsp;usuario&nbsp;pase&nbsp;como&nbsp;argumento</tt></dd></dl>\n",
"</td></tr></table>\n",
"</body></html>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from IPython.display import HTML\n",
"HTML(filename=\"miModulo/tarea2_ejercicios1.html\")"
]
} }
], ],
"metadata": { "metadata": {
...@@ -1384,4 +1452,3 @@ ...@@ -1384,4 +1452,3 @@
"nbformat": 4, "nbformat": 4,
"nbformat_minor": 2 "nbformat_minor": 2
} }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
No preview for this file type
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module tarea2_ejercicios1</title>
<meta charset="utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>tarea2_ejercicios1</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/carlosgarcia8/repos/tap1012/miModulo/tarea2_ejercicios1.py">/home/carlosgarcia8/repos/tap1012/miModulo/tarea2_ejercicios1.py</a></font></td></tr></table>
<p><tt>Documentación&nbsp;para&nbsp;la&nbsp;segunda&nbsp;tarea&nbsp;(ejercicios&nbsp;1)&nbsp;de&nbsp;la&nbsp;materia&nbsp;de&nbsp;Tópicos&nbsp;Avanzados&nbsp;de&nbsp;Programación.<br>
Maestría&nbsp;GeoInteligencia&nbsp;Computacional&nbsp;a&nbsp;27&nbsp;de&nbsp;Enero&nbsp;del&nbsp;2019.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-coincide"><strong>coincide</strong></a>(l1, l2)</dt><dd><tt>Función&nbsp;que&nbsp;devuelve&nbsp;todos&nbsp;los&nbsp;elementos&nbsp;coincidentes&nbsp;de&nbsp;un&nbsp;par&nbsp;de&nbsp;listas&nbsp;que&nbsp;el&nbsp;usuario&nbsp;pase&nbsp;como&nbsp;argumento</tt></dd></dl>
<dl><dt><a name="-numerMay"><strong>numerMay</strong></a>(l1)</dt><dd><tt>Función&nbsp;que&nbsp;devuelve&nbsp;los&nbsp;números&nbsp;estrictamente&nbsp;mayores&nbsp;a&nbsp;10&nbsp;de&nbsp;una&nbsp;lista&nbsp;que&nbsp;el&nbsp;usuario&nbsp;pase&nbsp;como&nbsp;argumento</tt></dd></dl>
<dl><dt><a name="-numerPar"><strong>numerPar</strong></a>()</dt><dd><tt>Función&nbsp;que&nbsp;devuelve&nbsp;los&nbsp;números&nbsp;pares&nbsp;de&nbsp;una&nbsp;lista&nbsp;que&nbsp;el&nbsp;usuario&nbsp;pase&nbsp;como&nbsp;argumento</tt></dd></dl>
</td></tr></table>
</body></html>
\ No newline at end of file
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Documentación para la segunda tarea (ejercicios 1) de la materia de Tópicos Avanzados de Programación.
Maestría GeoInteligencia Computacional a 27 de Enero del 2019.
"""
def numerPar():
'''
Función que devuelve los números pares de una lista que el usuario pase como argumento
'''
lista=[x for x in range(0,21) if x%2==0]
return lista
def numerMay(l1):
'''
Función que devuelve los números estrictamente mayores a 10 de una lista que el usuario pase como argumento
'''
lista=[x for x in l1 if x>10]
return lista
def coincide(l1,l2):
'''
Función que devuelve todos los elementos coincidentes de un par de listas que el usuario pase como argumento
'''
coin=set([x for x in l1 if x in l2])
return coin
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