Commit 60023428 authored by geobumac's avatar geobumac

examen1 corren faltantes

parent 171629ea
...@@ -119,16 +119,16 @@ ...@@ -119,16 +119,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 35, "execution_count": 39,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"1" "3628800"
] ]
}, },
"execution_count": 35, "execution_count": 39,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
" return 1\n", " return 1\n",
" else:\n", " else:\n",
" return numero * ejercicio3( numero - 1 )\n", " return numero * ejercicio3( numero - 1 )\n",
"ejercicio3(0)\n", "ejercicio3(10)\n",
"#import doctest\n", "#import doctest\n",
"#doctest.run_docstring_examples(ejercicio3, globals(), verbose=True)" "#doctest.run_docstring_examples(ejercicio3, globals(), verbose=True)"
] ]
...@@ -168,9 +168,17 @@ ...@@ -168,9 +168,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 42,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1, 3, 5, 7, 9, 11, 33, 55, 77, 99, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191, 303, 313, 323, 333, 343, 353, 363, 373, 383, 393, 505, 515, 525, 535, 545, 555, 565, 575, 585, 595, 707, 717, 727, 737, 747, 757, 767, 777, 787, 797, 909, 919, 929, 939, 949, 959, 969, 979, 989, 999]\n"
]
}
],
"source": [ "source": [
"def ejercicio4(minimo, maximo):\n", "def ejercicio4(minimo, maximo):\n",
" \"\"\"ejercicio4 funcion que devuelve una lista de elementos los cuales son impares y palindormos\n", " \"\"\"ejercicio4 funcion que devuelve una lista de elementos los cuales son impares y palindormos\n",
...@@ -192,7 +200,7 @@ ...@@ -192,7 +200,7 @@
" impares = [i for i in range(minimo, maximo) if i%2 != 0]\n", " impares = [i for i in range(minimo, maximo) if i%2 != 0]\n",
" #reversestring = [int(str(i)[::-1]) for i in impares]\n", " #reversestring = [int(str(i)[::-1]) for i in impares]\n",
" return list(filter(lambda x: x == int(str(x)[::-1]), impares))\n", " return list(filter(lambda x: x == int(str(x)[::-1]), impares))\n",
"print(ejercicio4(0,10))\n", "print(ejercicio4(0,1000))\n",
"#import doctest\n", "#import doctest\n",
"#doctest.run_docstring_examples(ejercicio4, globals(), verbose=True)" "#doctest.run_docstring_examples(ejercicio4, globals(), verbose=True)"
] ]
......
...@@ -119,16 +119,16 @@ ...@@ -119,16 +119,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 35, "execution_count": 39,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"1" "3628800"
] ]
}, },
"execution_count": 35, "execution_count": 39,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
" return 1\n", " return 1\n",
" else:\n", " else:\n",
" return numero * ejercicio3( numero - 1 )\n", " return numero * ejercicio3( numero - 1 )\n",
"ejercicio3(0)\n", "ejercicio3(10)\n",
"#import doctest\n", "#import doctest\n",
"#doctest.run_docstring_examples(ejercicio3, globals(), verbose=True)" "#doctest.run_docstring_examples(ejercicio3, globals(), verbose=True)"
] ]
...@@ -168,9 +168,17 @@ ...@@ -168,9 +168,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 42,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1, 3, 5, 7, 9, 11, 33, 55, 77, 99, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191, 303, 313, 323, 333, 343, 353, 363, 373, 383, 393, 505, 515, 525, 535, 545, 555, 565, 575, 585, 595, 707, 717, 727, 737, 747, 757, 767, 777, 787, 797, 909, 919, 929, 939, 949, 959, 969, 979, 989, 999]\n"
]
}
],
"source": [ "source": [
"def ejercicio4(minimo, maximo):\n", "def ejercicio4(minimo, maximo):\n",
" \"\"\"ejercicio4 funcion que devuelve una lista de elementos los cuales son impares y palindormos\n", " \"\"\"ejercicio4 funcion que devuelve una lista de elementos los cuales son impares y palindormos\n",
...@@ -192,7 +200,7 @@ ...@@ -192,7 +200,7 @@
" impares = [i for i in range(minimo, maximo) if i%2 != 0]\n", " impares = [i for i in range(minimo, maximo) if i%2 != 0]\n",
" #reversestring = [int(str(i)[::-1]) for i in impares]\n", " #reversestring = [int(str(i)[::-1]) for i in impares]\n",
" return list(filter(lambda x: x == int(str(x)[::-1]), impares))\n", " return list(filter(lambda x: x == int(str(x)[::-1]), impares))\n",
"print(ejercicio4(0,10))\n", "print(ejercicio4(0,1000))\n",
"#import doctest\n", "#import doctest\n",
"#doctest.run_docstring_examples(ejercicio4, globals(), verbose=True)" "#doctest.run_docstring_examples(ejercicio4, globals(), verbose=True)"
] ]
......
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