Commit b7f502f0 authored by Mario Chirinos Colunga's avatar Mario Chirinos Colunga 💬

opp

parent 34d13754
......@@ -24,7 +24,9 @@
"* 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"
"* Interactivo (con ipython)\n",
"\n",
"*Nota: Python obtiene su nombre del programa de la BBC [Monty Python's Flying Circus](https://www.imdb.com/title/tt0063929/).*"
]
},
{
......@@ -834,7 +836,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.5.5 Escribe una funcion que sume todos los uneros en una lista."
"### 1.5.5 Escribe una funcion que sume todos los numeros en una lista usando for."
]
},
{
......@@ -911,7 +913,7 @@
"def pascal(n):\n",
" pass\n",
"numero = input(\"Indica el numero de filas:\")\n",
"pascal(numero)"
"pascal(numero)\n"
]
},
{
......
......@@ -16,7 +16,7 @@
},
{
"cell_type": "code",
"execution_count": 31,
"execution_count": 1,
"metadata": {},
"outputs": [
{
......@@ -25,7 +25,7 @@
"[2, 2, 4, 6, 8]"
]
},
"execution_count": 31,
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
......@@ -41,7 +41,7 @@
},
{
"cell_type": "code",
"execution_count": 40,
"execution_count": 2,
"metadata": {},
"outputs": [
{
......@@ -50,7 +50,7 @@
"[2, 2, 4, 6, 8]"
]
},
"execution_count": 40,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
......@@ -63,7 +63,7 @@
},
{
"cell_type": "code",
"execution_count": 38,
"execution_count": 3,
"metadata": {},
"outputs": [
{
......@@ -81,7 +81,7 @@
" 9: 387420489}"
]
},
"execution_count": 38,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
......@@ -93,7 +93,7 @@
},
{
"cell_type": "code",
"execution_count": 37,
"execution_count": 4,
"metadata": {},
"outputs": [
{
......@@ -102,7 +102,7 @@
"[[1, 0, 0], [0, 1, 0], [0, 0, 1]]"
]
},
"execution_count": 37,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
......@@ -114,7 +114,7 @@
},
{
"cell_type": "code",
"execution_count": 34,
"execution_count": null,
"metadata": {},
"outputs": [
{
......@@ -123,7 +123,7 @@
"{1, 2, 3, 4, 5, 6, 7, 8, 9}"
]
},
"execution_count": 34,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
......@@ -151,7 +151,7 @@
},
{
"cell_type": "code",
"execution_count": 77,
"execution_count": null,
"metadata": {},
"outputs": [
{
......@@ -160,7 +160,7 @@
"function"
]
},
"execution_count": 77,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
......@@ -172,7 +172,7 @@
},
{
"cell_type": "code",
"execution_count": 41,
"execution_count": null,
"metadata": {},
"outputs": [
{
......@@ -181,7 +181,7 @@
"[4, 4, 256, 46656, 16777216]"
]
},
"execution_count": 41,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
......@@ -192,7 +192,7 @@
},
{
"cell_type": "code",
"execution_count": 47,
"execution_count": null,
"metadata": {},
"outputs": [
{
......@@ -201,7 +201,7 @@
"[(13, -3), (4, 1), (1, 2), (9, 10)]"
]
},
"execution_count": 47,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
......@@ -214,7 +214,7 @@
},
{
"cell_type": "code",
"execution_count": 51,
"execution_count": null,
"metadata": {},
"outputs": [
{
......@@ -241,7 +241,7 @@
},
{
"cell_type": "code",
"execution_count": 55,
"execution_count": null,
"metadata": {},
"outputs": [
{
......@@ -272,7 +272,7 @@
},
{
"cell_type": "code",
"execution_count": 66,
"execution_count": null,
"metadata": {},
"outputs": [
{
......@@ -297,6 +297,25 @@
"print(list(doublesG))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"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",
"sum(fib(a)) \n",
"#for n in fib(a):\n",
"# print(n)"
]
},
{
"cell_type": "markdown",
"metadata": {},
......@@ -308,7 +327,7 @@
},
{
"cell_type": "code",
"execution_count": 67,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
......@@ -325,7 +344,7 @@
},
{
"cell_type": "code",
"execution_count": 69,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
......@@ -342,7 +361,7 @@
},
{
"cell_type": "code",
"execution_count": 72,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
......@@ -360,7 +379,7 @@
},
{
"cell_type": "code",
"execution_count": 74,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
......@@ -377,7 +396,7 @@
},
{
"cell_type": "code",
"execution_count": 76,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
......@@ -394,7 +413,7 @@
},
{
"cell_type": "code",
"execution_count": 78,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
......@@ -423,7 +442,7 @@
},
{
"cell_type": "code",
"execution_count": 80,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
......@@ -447,17 +466,9 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"hello\n"
]
}
],
"outputs": [],
"source": [
"from miModulo import helloWorld\n",
"helloWorld.hello()"
......@@ -474,50 +485,9 @@
},
{
"cell_type": "code",
"execution_count": 89,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Generators have a ``Yields`` section instead of a ``Returns`` section.\n",
"\n",
" Args:\n",
" n (int): The upper limit of the range to generate, from 0 to `n` - 1.\n",
"\n",
" Yields:\n",
" int: The next number in the range of 0 to `n` - 1.\n",
"\n",
" Examples:\n",
" Examples should be written in doctest format, and should illustrate how\n",
" to use the function.\n",
"\n",
" >>> print([i for i in example_generator(4)])\n",
" [0, 1, 2, 3]\n",
"\n",
" \n",
"Help on function example_generator in module __main__:\n",
"\n",
"example_generator(n)\n",
" Generators have a ``Yields`` section instead of a ``Returns`` section.\n",
" \n",
" Args:\n",
" n (int): The upper limit of the range to generate, from 0 to `n` - 1.\n",
" \n",
" Yields:\n",
" int: The next number in the range of 0 to `n` - 1.\n",
" \n",
" Examples:\n",
" Examples should be written in doctest format, and should illustrate how\n",
" to use the function.\n",
" \n",
" >>> print([i for i in example_generator(4)])\n",
" [0, 1, 2, 3]\n",
"\n"
]
}
],
"outputs": [],
"source": [
"def example_generator(n):\n",
" \"\"\"Generators have a ``Yields`` section instead of a ``Returns`` section.\n",
......@@ -555,7 +525,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
......@@ -566,49 +536,9 @@
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n",
"<html><head><title>Python: module helloWorld</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>helloWorld</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/mchc/git/tap1012/miModulo/helloWorld.py\">/home/mchc/git/tap1012/miModulo/helloWorld.py</a></font></td></tr></table>\n",
" <p><tt>This&nbsp;example&nbsp;module&nbsp;shows&nbsp;various&nbsp;types&nbsp;of&nbsp;documentation&nbsp;available&nbsp;for&nbsp;use<br>\n",
"with&nbsp;pydoc.&nbsp;&nbsp;To&nbsp;generate&nbsp;HTML&nbsp;documentation&nbsp;for&nbsp;this&nbsp;module&nbsp;issue&nbsp;the<br>\n",
"command:<br>\n",
"&nbsp;<br>\n",
"&nbsp;&nbsp;&nbsp;&nbsp;pydoc&nbsp;-w&nbsp;foo</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=\"-hello\"><strong>hello</strong></a>()</dt><dd><tt>Documentacion&nbsp;de&nbsp;función&nbsp;<a href=\"#-hello\">hello</a>()&nbsp;del&nbsp;modulo&nbsp;miModulo.</tt></dd></dl>\n",
"</td></tr></table>\n",
"</body></html>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 6,
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"from IPython.display import HTML\n",
"HTML(filename=\"miModulo/helloWorld.html\")"
......@@ -625,7 +555,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 1,
"metadata": {},
"outputs": [
{
......@@ -657,7 +587,7 @@
"TestResults(failed=0, attempted=2)"
]
},
"execution_count": 10,
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
......
This diff is collapsed.
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