Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
tap1012
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
tap1012
Commits
c9929aaa
Commit
c9929aaa
authored
Jan 17, 2019
by
Carlos David García Hernández
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Entrega Final
parent
8340fc7f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
269 additions
and
40 deletions
+269
-40
01-DataTypes&ControlFlow.ipynb
01-DataTypes&ControlFlow.ipynb
+269
-40
No files found.
01-DataTypes&ControlFlow.ipynb
View file @
c9929aaa
...
...
@@ -690,7 +690,7 @@
},
{
"cell_type": "code",
"execution_count": 2
6
,
"execution_count": 2
14
,
"metadata": {},
"outputs": [
{
...
...
@@ -702,16 +702,6 @@
"Hello Mario!\n",
"Hello Alex!!\n"
]
},
{
"data": {
"text/plain": [
"[1]"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
...
...
@@ -721,8 +711,7 @@
"Hello(\"Mario\",\"?\")\n",
"Hello(x=\"!\", name=\"Mario\")\n",
"p = {\"name\":\"Alex\", \"x\":\"!!\"}\n",
"Hello(**p)\n",
"[1,]"
"Hello(**p)"
]
},
{
...
...
@@ -734,7 +723,7 @@
},
{
"cell_type": "code",
"execution_count": 2
7
,
"execution_count": 2
13
,
"metadata": {},
"outputs": [
{
...
...
@@ -745,7 +734,7 @@
"0 4 5\n",
"[6, 7, 8] 1 2\n",
"6 7 8\n",
"{'
a': 9, 'b': 10
, 'c': 11} 1 2\n",
"{'
b': 10, 'a': 9
, 'c': 11} 1 2\n",
"9 10 11\n"
]
}
...
...
@@ -774,7 +763,7 @@
},
{
"cell_type": "code",
"execution_count":
31
,
"execution_count":
90
,
"metadata": {},
"outputs": [
{
...
...
@@ -802,7 +791,7 @@
},
{
"cell_type": "code",
"execution_count":
40
,
"execution_count":
91
,
"metadata": {},
"outputs": [
{
...
...
@@ -836,14 +825,14 @@
},
{
"cell_type": "code",
"execution_count":
73
,
"execution_count":
92
,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{
34, 21, 55, 89
}\n"
"{
1, 2, 3, 5, 8, 13
}\n"
]
}
],
...
...
@@ -852,7 +841,7 @@
"b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]\n",
"\n",
"coincide=[]\n",
"coincide=set(a).
difference
(b)\n",
"coincide=set(a).
intersection
(b)\n",
"print(coincide)\n"
]
},
...
...
@@ -865,12 +854,42 @@
},
{
"cell_type": "code",
"execution_count":
30
,
"execution_count":
93
,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ingresa los N elementos de la secuencia de Fibonacci?\n",
": 10\n"
]
},
{
"data": {
"text/plain": [
"[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]"
]
},
"execution_count": 93,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def fibonacci(n):\n",
" pass"
" if n == 0:\n",
" return [0]\n",
" elif n == 1:\n",
" return [0, 1]\n",
" else:\n",
" listaF = fibonacci(n-1)\n",
" listaF.append(listaF[-1] + listaF[-2])\n",
" return listaF\n",
" \n",
"tamaño=int(input(\"Ingresa los N elementos de la secuencia de Fibonacci?\\n: \"))\n",
"tamaño=tamaño-1\n",
"fibonacci(tamaño)"
]
},
{
...
...
@@ -882,7 +901,7 @@
},
{
"cell_type": "code",
"execution_count":
104
,
"execution_count":
97
,
"metadata": {},
"outputs": [
{
...
...
@@ -891,7 +910,7 @@
"20"
]
},
"execution_count":
104
,
"execution_count":
97
,
"metadata": {},
"output_type": "execute_result"
}
...
...
@@ -917,11 +936,27 @@
},
{
"cell_type": "code",
"execution_count":
32
,
"execution_count":
98
,
"metadata": {},
"outputs": [],
"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]"
"a = [1,2,2,3,3,3,3,4,5,5]\n",
"\n",
"def unicos(lista):\n",
" norep=[]\n",
" norep=set(lista)\n",
" print(norep)\n",
"\n",
"unicos(a)\n",
" "
]
},
{
...
...
@@ -934,23 +969,52 @@
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Se probó con los numeros\n",
"* 28\n",
"* 496\n",
"* 8128\n",
"* 33 550 336\n",
"\n",
"Ya los otros jamás termino de cargar :)"
]
},
{
"cell_type": "code",
"execution_count":
34
,
"execution_count":
212
,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Escribe un nuemero:8\n"
"Ingresa tu numero\n",
": 6\n"
]
},
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 212,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def perfect(x):\n",
" pass\n",
"numero = input(\"Escribe un nuemero:\")\n",
"def perfect(n):\n",
" sum = 0\n",
" for x in range(1, n):\n",
" if n % x == 0:\n",
" sum += x\n",
" return sum == n\n",
"\n",
"numero = int(input(\"Ingresa tu numero\\n: \"))\n",
"perfect(numero)"
]
},
...
...
@@ -966,16 +1030,124 @@
},
{
"cell_type": "code",
"execution_count":
null
,
"execution_count":
241
,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Indica el numero de filas\n",
":5\n",
"[[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1], [1, 5, 10, 10, 5, 1]]\n"
]
}
],
"source": [
"def pascal(n):\n",
" pass\n",
"numero = input(\"Indica el numero de filas:\")\n",
" lista = [[1],[1,1]]\n",
" for i in range(1,n):\n",
" linea = [1]\n",
" for j in range(0,len(lista[i])-1):\n",
" #Suerte de Join\n",
" linea.extend([ lista[i][j] + lista[i][j+1] ])\n",
" linea += [1]\n",
" lista.append(linea) \n",
" print (lista)\n",
" \n",
"numero = int(input(\"Indica el numero de filas\\n:\"))\n",
"pascal(numero)"
]
},
{
"cell_type": "code",
"execution_count": 247,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\n",
"1\n",
"2\n",
"[[1], [1, 1], [1, 2, 1]]\n",
"1\n",
"2\n",
"3\n",
"2\n",
"1\n",
"3\n",
"[[1], [1, 1], [1, 2, 1], [1, 3, 3, 1]]\n",
"1\n",
"3\n",
"4\n",
"3\n",
"3\n",
"6\n",
"3\n",
"1\n",
"4\n",
"[[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1]]\n",
"1\n",
"4\n",
"5\n",
"4\n",
"6\n",
"10\n",
"6\n",
"4\n",
"10\n",
"4\n",
"1\n",
"5\n",
"[[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1], [1, 5, 10, 10, 5, 1]]\n"
]
}
],
"source": [
"##Prueba (NO TENER EN CUENTA)\n",
"\n",
"def pascal(n):\n",
" lista = [[1],[1,1]]\n",
" for i in range(1,n):\n",
" linea = [1]\n",
" for j in range(0,len(lista[i])-1):\n",
" print(lista[i][j])\n",
" print(lista[i][j+1])\n",
" print(lista[i][j]+lista[i][j+1])\n",
" linea.extend([ lista[i][j] + lista[i][j+1] ])\n",
" linea += [1]\n",
" lista.append(linea)\n",
" print(lista)\n",
"pascal(5)"
]
},
{
"cell_type": "code",
"execution_count": 174,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{(3, 'three'), (2, 'two'), (1, 'one')}\n"
]
}
],
"source": [
"numberList = [1, 2, 3]\n",
"strList = ['one', 'two', 'three']\n",
"\n",
"# Two iterables are passed\n",
"result = zip(numberList, strList)\n",
"\n",
"# Converting itertor to set\n",
"resultSet = set(result)\n",
"print(resultSet)"
]
},
{
"cell_type": "markdown",
"metadata": {},
...
...
@@ -984,6 +1156,40 @@
"[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": 140,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ingrese su frase\n",
": abcdefghijklmnñopqrstuvwxz\n",
"abcdefghijklmnñopqrstuvwxz abcdefghijklmnñopqrstuvwxyz\n",
"No es pangrama :v\n"
]
}
],
"source": [
"def pangrama(Frase):\n",
" alfabeto = \"abcdefghijklmnñopqrstuvwxyz\"\n",
" letrasF = \"\"\n",
" for char in Frase:\n",
" if char in alfabeto:\n",
" letrasF += char\n",
" for char in alfabeto:\n",
" if char not in Frase:\n",
" print (letrasF, alfabeto)\n",
" return print(\"No es pangrama :v\")\n",
"\n",
" return print(\"Si es pangrama! :)\")\n",
"\n",
"Frase1 = str(input(\"Ingrese su frase\\n: \"))\n",
"pangrama(Frase1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
...
...
@@ -1010,10 +1216,33 @@
},
{
"cell_type": "code",
"execution_count":
null
,
"execution_count":
84
,
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\n",
"22\n",
"333\n",
"4444\n",
"55555\n",
"666666\n",
"7777777\n",
"88888888\n",
"999999999\n"
]
}
],
"source": [
"numeros=list(range(1,10))\n",
"numerosT=[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\"]\n",
"\n",
"for numT in numerosT:\n",
" print(numT*int(numT))\n",
" \n"
]
}
],
"metadata": {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment