Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
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
abb0d2f2
Commit
abb0d2f2
authored
6 years ago
by
geobumac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ejercicios 2
parent
2e94e286
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
180 additions
and
27 deletions
+180
-27
02-Comprehension&Documentation-checkpoint.ipynb
...eckpoints/02-Comprehension&Documentation-checkpoint.ipynb
+163
-23
02-Comprehension&Documentation.ipynb
02-Comprehension&Documentation.ipynb
+17
-4
No files found.
.ipynb_checkpoints/02-Comprehension&Documentation-checkpoint.ipynb
View file @
abb0d2f2
...
...
@@ -173,22 +173,23 @@
},
{
"cell_type": "code",
"execution_count": 4
1
,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[
4, 4, 256, 46656, 16777216
]"
"[
27, 46656, 387420489
]"
]
},
"execution_count": 4
1
,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"list(map(lambda i: i**i, filter(lambda i: i%2==0, old_list)))"
"old_list = [1,2,2,3,4,5,6,7,7,8,9]\n",
"list(map(lambda i: i**i, filter(lambda i: i%3==0, old_list)))"
]
},
{
...
...
@@ -309,11 +310,22 @@
},
{
"
cell_type
"
:
"
code
",
"
execution_count
"
:
6
7
,
"
execution_count
"
:
6
,
"
metadata
"
:
{},
"
outputs
"
:
[],
"
outputs
"
:
[
{
"
name
"
:
"
stdout
",
"
output_type
"
:
"
stream
",
"
text
"
:
[
"
pares
[
0
,
2
,
4
,
6
,
8
]\
n
",
"
impares
[
1
,
3
,
5
,
7
,
9
]\
n
"
]
}
],
"
source
"
:
[
"
a =
[0,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
]"
"
a =
[0,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
]\
n
",
"
print
(\"
pares
\",
[
i
for
i
in
a
if
i
%
2=
=0])\n",
"
print
(\"
impares
\",
[
i
for
i
in
a
if
i
%
2
!=
0
])"
]
},
{
...
...
@@ -326,11 +338,24 @@
},
{
"
cell_type
"
:
"
code
",
"
execution_count
"
:
69
,
"
execution_count
"
:
25
,
"
metadata
"
:
{},
"
outputs
"
:
[],
"
outputs
"
:
[
{
"
data
"
:
{
"
text
/
plain
"
:
[
"[[
0
,
'
apple
'],
[
1
,
'
banana
'],
[
2
,
'
grapes
'],
[
3
,
'
pear
']]"
]
},
"
execution_count
"
:
25
,
"
metadata
"
:
{},
"
output_type
"
:
"
execute_result
"
}
],
"
source
"
:
[
"
my_list =
['apple',
'
banana
',
'
grapes
',
'
pear
']\
n
"
"
my_list =
['apple',
'
banana
',
'
grapes
',
'
pear
']\
n
",
"[[
i
,
my_list
[
i
]]
for
i
in
range
(
0
,
len
(
my_list
))]\
n
",
"\
n
"
]
},
{
...
...
@@ -343,12 +368,65 @@
},
{
"
cell_type
"
:
"
code
",
"
execution_count
"
:
72
,
"
execution_count
"
:
27
,
"
metadata
"
:
{},
"
outputs
"
:
[],
"
outputs
"
:
[
{
"
data
"
:
{
"
text
/
plain
"
:
[
"[[
0
,
'
a
'],\
n
",
"
[
0
,
'
b
'],\
n
",
"
[
0
,
'
c
'],\
n
",
"
[
0
,
'
d
'],\
n
",
"
[
0
,
'
e
'],\
n
",
"
[
0
,
'
f
'],\
n
",
"
[
1
,
'
a
'],\
n
",
"
[
1
,
'
b
'],\
n
",
"
[
1
,
'
c
'],\
n
",
"
[
1
,
'
d
'],\
n
",
"
[
1
,
'
e
'],\
n
",
"
[
1
,
'
f
'],\
n
",
"
[
2
,
'
a
'],\
n
",
"
[
2
,
'
b
'],\
n
",
"
[
2
,
'
c
'],\
n
",
"
[
2
,
'
d
'],\
n
",
"
[
2
,
'
e
'],\
n
",
"
[
2
,
'
f
'],\
n
",
"
[
3
,
'
a
'],\
n
",
"
[
3
,
'
b
'],\
n
",
"
[
3
,
'
c
'],\
n
",
"
[
3
,
'
d
'],\
n
",
"
[
3
,
'
e
'],\
n
",
"
[
3
,
'
f
'],\
n
",
"
[
4
,
'
a
'],\
n
",
"
[
4
,
'
b
'],\
n
",
"
[
4
,
'
c
'],\
n
",
"
[
4
,
'
d
'],\
n
",
"
[
4
,
'
e
'],\
n
",
"
[
4
,
'
f
'],\
n
",
"
[
5
,
'
a
'],\
n
",
"
[
5
,
'
b
'],\
n
",
"
[
5
,
'
c
'],\
n
",
"
[
5
,
'
d
'],\
n
",
"
[
5
,
'
e
'],\
n
",
"
[
5
,
'
f
'],\
n
",
"
[
6
,
'
a
'],\
n
",
"
[
6
,
'
b
'],\
n
",
"
[
6
,
'
c
'],\
n
",
"
[
6
,
'
d
'],\
n
",
"
[
6
,
'
e
'],\
n
",
"
[
6
,
'
f
']]"
]
},
"
execution_count
"
:
27
,
"
metadata
"
:
{},
"
output_type
"
:
"
execute_result
"
}
],
"
source
"
:
[
"
a =
[0,1,2,3,4,5,6]\n",
"
b =
[\"a\",\"b\",\"c\",\"d\",\"e\",\"f\"]"
"
b =
[\"a\",\"b\",\"c\",\"d\",\"e\",\"f\"]\n",
"[[
i
,
n
]
for
i
in
a
for
n
in
b
]"
]
},
{
...
...
@@ -361,11 +439,23 @@
},
{
"
cell_type
"
:
"
code
",
"
execution_count
"
:
74
,
"
execution_count
"
:
31
,
"
metadata
"
:
{},
"
outputs
"
:
[],
"
outputs
"
:
[
{
"
data
"
:
{
"
text
/
plain
"
:
[
"[
22
,
54
,
62
]"
]
},
"
execution_count
"
:
31
,
"
metadata
"
:
{},
"
output_type
"
:
"
execute_result
"
}
],
"
source
"
:
[
"
a=
[5,
7
,
22
,
97
,
54
,
62
,
77
,
23
,
73
,
61
]"
"
a=
[5,
7
,
22
,
97
,
54
,
62
,
77
,
23
,
73
,
61
]\
n
",
"
list
(
filter
(
lambda
x:x
%
2 =
=
0
,
a
))"
]
},
{
...
...
@@ -378,11 +468,24 @@
},
{
"
cell_type
"
:
"
code
",
"
execution_count
"
:
76
,
"
execution_count
"
:
34
,
"
metadata
"
:
{},
"
outputs
"
:
[],
"
outputs
"
:
[
{
"
data
"
:
{
"
text
/
plain
"
:
[
"
193
"
]
},
"
execution_count
"
:
34
,
"
metadata
"
:
{},
"
output_type
"
:
"
execute_result
"
}
],
"
source
"
:
[
"
a =
[5,
8
,
10
,
20
,
50
,
100
]
"
"
from
functools
import
reduce
\
n
",
"
a =
[5,
8
,
10
,
20
,
50
,
100
]
\
n
",
"
reduce
((
lambda
x
,
y:
x
+
y
),
a
)"
]
},
{
...
...
@@ -395,13 +498,26 @@
},
{
"
cell_type
"
:
"
code
",
"
execution_count
"
:
78
,
"
execution_count
"
:
39
,
"
metadata
"
:
{},
"
outputs
"
:
[],
"
outputs
"
:
[
{
"
data
"
:
{
"
text
/
plain
"
:
[
"[
35
,
45
,
55
,
65
]"
]
},
"
execution_count
"
:
39
,
"
metadata
"
:
{},
"
output_type
"
:
"
execute_result
"
}
],
"
source
"
:
[
"
a =
[5,
10
,
15
,
20
]\
n
",
"
\
n
",
"
b =
[30,
35
,
40
,
45
]"
"
b =
[30,
35
,
40
,
45
]\
n
",
"\
n
",
"
list
(
map
(
lambda
x
,
y:
x
+
y
,
a
,
b
))"
]
},
{
...
...
@@ -414,6 +530,30 @@
"[
Wikipedia
](
https:
//
es
.
wikipedia
.
org
/
wiki
/
Terna_pitag
%
C3
%
B3rica
)
:
Una
terna
pitag
ó
rica
es
un
conjunto
ordenado
de
tres
n
ú
meros
enteros
positivos
a
,
b
,
c
,
y
son
soluci
ó
n
de
la
ecuaci
ó
n
diofantina
cuadr
á
tica
$
a
^{
2
}+
b
^{
2
}=
c
^{
2
}$.\
n
"
]
},
{
"
cell_type
"
:
"
code
",
"
execution_count
"
:
38
,
"
metadata
"
:
{},
"
outputs
"
:
[
{
"
name
"
:
"
stdout
",
"
output_type
"
:
"
stream
",
"
text
"
:
[
"
0
\
n
"
]
}
],
"
source
"
:
[
"
def
pitagoricas
(
n
)
:
\
n
",
"
num =
0\n",
"
while
num
<=
n:
\
n
",
"
yield
[]\
n
",
"
num
+=
1
\
n
",
"\
n
",
"
pit =
pitagoricas(10)\n",
"
print
(
next
(
pit
))"
]
},
{
"
cell_type
"
:
"
markdown
",
"
metadata
"
:
{},
...
...
@@ -428,7 +568,7 @@
"
metadata
"
:
{},
"
outputs
"
:
[],
"
source
"
:
[
"
a =
[\"a\",
\"
b
\",
\"
c
\"]"
"
a =
[\"a\",
\"
b
\",
\"
c
\"]
\
n
"
]
},
{
...
...
This diff is collapsed.
Click to expand it.
02-Comprehension&Documentation.ipynb
View file @
abb0d2f2
...
...
@@ -498,13 +498,26 @@
},
{
"
cell_type
"
:
"
code
",
"
execution_count
"
:
78
,
"
execution_count
"
:
39
,
"
metadata
"
:
{},
"
outputs
"
:
[],
"
outputs
"
:
[
{
"
data
"
:
{
"
text
/
plain
"
:
[
"[
35
,
45
,
55
,
65
]"
]
},
"
execution_count
"
:
39
,
"
metadata
"
:
{},
"
output_type
"
:
"
execute_result
"
}
],
"
source
"
:
[
"
a =
[5,
10
,
15
,
20
]\
n
",
"
\
n
",
"
b =
[30,
35
,
40
,
45
]"
"
b =
[30,
35
,
40
,
45
]\
n
",
"\
n
",
"
list
(
map
(
lambda
x
,
y:
x
+
y
,
a
,
b
))"
]
},
{
...
...
@@ -555,7 +568,7 @@
"
metadata
"
:
{},
"
outputs
"
:
[],
"
source
"
:
[
"
a =
[\"a\",
\"
b
\",
\"
c
\"]"
"
a =
[\"a\",
\"
b
\",
\"
c
\"]
\
n
"
]
},
{
...
...
This diff is collapsed.
Click to expand it.
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