Commit 7801628b authored by alan's avatar alan

salon

parent c90badaa
...@@ -297,6 +297,81 @@ ...@@ -297,6 +297,81 @@
"print(list(doublesG))" "print(list(doublesG))"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"l=[1,9,36,84,]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"ejemplos de clase del 29 de enero del 2019"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 1 3\n",
"1 3 3\n",
"2 3 1\n"
]
}
],
"source": [
"previa=[1,3,3,1]\n",
"for i,x in enumerate (previa[:-1]):\n",
" print (i, x, previa [(i+1)])"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "invalid syntax (<ipython-input-6-7b01b3b18e9d>, line 5)",
"output_type": "error",
"traceback": [
"\u001b[0;36m File \u001b[0;32m\"<ipython-input-6-7b01b3b18e9d>\"\u001b[0;36m, line \u001b[0;32m5\u001b[0m\n\u001b[0;31m nueva=[1] + [x+previa[i+1]] for i,x in numerate(previa(:-1))+[1]\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
]
}
],
"source": [
"def genpascal(n):\n",
" previa =[1,1]\n",
" nueva=[1,2,1]\n",
" while len(nueva) < n:\n",
" nueva=[1] + [x+previa[i+1]] for i,x in numerate(previa(:-1))+[1]\n",
" yoeld nueva\n",
" previa=nueva\n",
" \n",
" \n",
"N=10\n",
"for i in genepascal(N):\n",
" print(*(N-len(i)),i)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print()"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
...@@ -339,6 +414,25 @@ ...@@ -339,6 +414,25 @@
"print(impar)\n" "print(impar)\n"
] ]
}, },
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['par', 'impar', 'par', 'impar', 'par', 'impar', 'par', 'impar', 'par', 'impar']\n"
]
}
],
"source": [
"a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n",
"b = list (map(lambda x: 'par' if x%2==0 else 'impar' , a ))\n",
"print(b)"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
...@@ -397,12 +491,45 @@ ...@@ -397,12 +491,45 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 72, "execution_count": 14,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[(0, 'a'), (0, 'b'), (0, 'c'), (0, 'd'), (0, 'e'), (0, 'f'), (1, 'a'), (1, 'b'), (1, 'c'), (1, 'd'), (1, 'e'), (1, 'f'), (2, 'a'), (2, 'b'), (2, 'c'), (2, 'd'), (2, 'e'), (2, 'f'), (3, 'a'), (3, 'b'), (3, 'c'), (3, 'd'), (3, 'e'), (3, 'f'), (4, 'a'), (4, 'b'), (4, 'c'), (4, 'd'), (4, 'e'), (4, 'f'), (5, 'a'), (5, 'b'), (5, 'c'), (5, 'd'), (5, 'e'), (5, 'f'), (6, 'a'), (6, 'b'), (6, 'c'), (6, 'd'), (6, 'e'), (6, 'f')]\n"
]
}
],
"source": [
"a = [0,1,2,3,4,5,6]\n",
"b = [\"a\",\"b\",\"c\",\"d\",\"e\",\"f\"]\n",
"\n",
"c=[ (x,y) for x in a for y in b]\n",
"print (c)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[('a', 0, -2), ('a', 0, 0.3), ('a', 0, -5), ('a', 0, 0.5), ('b', 0, -2), ('b', 0, 0.3), ('b', 0, -5), ('b', 0, 0.5), ('c', 0, -2), ('c', 0, 0.3), ('c', 0, -5), ('c', 0, 0.5), ('d', 0, -2), ('d', 0, 0.3), ('d', 0, -5), ('d', 0, 0.5), ('e', 0, -2), ('e', 0, 0.3), ('e', 0, -5), ('e', 0, 0.5), ('f', 0, -2), ('f', 0, 0.3), ('f', 0, -5), ('f', 0, 0.5), ('a', 1, -2), ('a', 1, 0.3), ('a', 1, -5), ('a', 1, 0.5), ('b', 1, -2), ('b', 1, 0.3), ('b', 1, -5), ('b', 1, 0.5), ('c', 1, -2), ('c', 1, 0.3), ('c', 1, -5), ('c', 1, 0.5), ('d', 1, -2), ('d', 1, 0.3), ('d', 1, -5), ('d', 1, 0.5), ('e', 1, -2), ('e', 1, 0.3), ('e', 1, -5), ('e', 1, 0.5), ('f', 1, -2), ('f', 1, 0.3), ('f', 1, -5), ('f', 1, 0.5), ('a', 2, -2), ('a', 2, 0.3), ('a', 2, -5), ('a', 2, 0.5), ('b', 2, -2), ('b', 2, 0.3), ('b', 2, -5), ('b', 2, 0.5), ('c', 2, -2), ('c', 2, 0.3), ('c', 2, -5), ('c', 2, 0.5), ('d', 2, -2), ('d', 2, 0.3), ('d', 2, -5), ('d', 2, 0.5), ('e', 2, -2), ('e', 2, 0.3), ('e', 2, -5), ('e', 2, 0.5), ('f', 2, -2), ('f', 2, 0.3), ('f', 2, -5), ('f', 2, 0.5), ('a', 3, -2), ('a', 3, 0.3), ('a', 3, -5), ('a', 3, 0.5), ('b', 3, -2), ('b', 3, 0.3), ('b', 3, -5), ('b', 3, 0.5), ('c', 3, -2), ('c', 3, 0.3), ('c', 3, -5), ('c', 3, 0.5), ('d', 3, -2), ('d', 3, 0.3), ('d', 3, -5), ('d', 3, 0.5), ('e', 3, -2), ('e', 3, 0.3), ('e', 3, -5), ('e', 3, 0.5), ('f', 3, -2), ('f', 3, 0.3), ('f', 3, -5), ('f', 3, 0.5), ('a', 4, -2), ('a', 4, 0.3), ('a', 4, -5), ('a', 4, 0.5), ('b', 4, -2), ('b', 4, 0.3), ('b', 4, -5), ('b', 4, 0.5), ('c', 4, -2), ('c', 4, 0.3), ('c', 4, -5), ('c', 4, 0.5), ('d', 4, -2), ('d', 4, 0.3), ('d', 4, -5), ('d', 4, 0.5), ('e', 4, -2), ('e', 4, 0.3), ('e', 4, -5), ('e', 4, 0.5), ('f', 4, -2), ('f', 4, 0.3), ('f', 4, -5), ('f', 4, 0.5), ('a', 5, -2), ('a', 5, 0.3), ('a', 5, -5), ('a', 5, 0.5), ('b', 5, -2), ('b', 5, 0.3), ('b', 5, -5), ('b', 5, 0.5), ('c', 5, -2), ('c', 5, 0.3), ('c', 5, -5), ('c', 5, 0.5), ('d', 5, -2), ('d', 5, 0.3), ('d', 5, -5), ('d', 5, 0.5), ('e', 5, -2), ('e', 5, 0.3), ('e', 5, -5), ('e', 5, 0.5), ('f', 5, -2), ('f', 5, 0.3), ('f', 5, -5), ('f', 5, 0.5), ('a', 6, -2), ('a', 6, 0.3), ('a', 6, -5), ('a', 6, 0.5), ('b', 6, -2), ('b', 6, 0.3), ('b', 6, -5), ('b', 6, 0.5), ('c', 6, -2), ('c', 6, 0.3), ('c', 6, -5), ('c', 6, 0.5), ('d', 6, -2), ('d', 6, 0.3), ('d', 6, -5), ('d', 6, 0.5), ('e', 6, -2), ('e', 6, 0.3), ('e', 6, -5), ('e', 6, 0.5), ('f', 6, -2), ('f', 6, 0.3), ('f', 6, -5), ('f', 6, 0.5)]\n"
]
}
],
"source": [ "source": [
"a = [0,1,2,3,4,5,6]\n", "a = [0,1,2,3,4,5,6]\n",
"b = [\"a\",\"b\",\"c\",\"d\",\"e\",\"f\"]" "b = [\"a\",\"b\",\"c\",\"d\",\"e\",\"f\"]\n",
"c = [-2,.3, -5,.5]\n",
"d=[ (y,x, z) for x in a for y in b for z in c]\n",
"\n",
"print (d)"
] ]
}, },
{ {
...@@ -616,6 +743,60 @@ ...@@ -616,6 +743,60 @@
"helloWorld.hello()" "helloWorld.hello()"
] ]
}, },
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"hello\n"
]
}
],
"source": [
"from miModulo.helloWorld import hello\n",
"hello()"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"hello\n"
]
}
],
"source": [
"from miModulo.helloWorld import hello as hola\n",
"hola()"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"hello\n"
]
}
],
"source": [
"import miModulo\n",
"miModulo.helloWorld.hello()\n"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"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