Skip to content

Commit d208522

Browse files
committed
creating a new branch
1 parent 9418939 commit d208522

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+27628
-0
lines changed

Solutions/en/Assignment_1.ipynb

Lines changed: 532 additions & 0 deletions
Large diffs are not rendered by default.

Solutions/en/Assignment_1_solutions.ipynb

Lines changed: 929 additions & 0 deletions
Large diffs are not rendered by default.

Solutions/en/Assignment_2.ipynb

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"## Second Assignment"
8+
]
9+
},
10+
{
11+
"cell_type": "markdown",
12+
"metadata": {},
13+
"source": [
14+
"#### 1) Create a function called **\"even_squared\"** that receives an integer value **N**, and returns a list containing, in ascending order, the square of each of the even values, from 1 to N, including N if applicable. "
15+
]
16+
},
17+
{
18+
"cell_type": "code",
19+
"execution_count": null,
20+
"metadata": {},
21+
"outputs": [],
22+
"source": []
23+
},
24+
{
25+
"cell_type": "markdown",
26+
"metadata": {},
27+
"source": [
28+
"#### 2) Using a while loop and the **input()** function, read an indefinite amount of **integers** until the number read is **-1**. After this process, print two lists on the screen: The first containing the even integers, and the second containing the odd integers. Both must be in ascending order. "
29+
]
30+
},
31+
{
32+
"cell_type": "code",
33+
"execution_count": null,
34+
"metadata": {},
35+
"outputs": [],
36+
"source": []
37+
},
38+
{
39+
"cell_type": "markdown",
40+
"metadata": {},
41+
"source": [
42+
"#### 3) Create a function called **\"even_account\"** that receives a list of integers, counts the number of existing even elements, and returns this count. "
43+
]
44+
},
45+
{
46+
"cell_type": "code",
47+
"execution_count": null,
48+
"metadata": {},
49+
"outputs": [],
50+
"source": []
51+
},
52+
{
53+
"cell_type": "markdown",
54+
"metadata": {},
55+
"source": [
56+
"#### 4) Create a function called **\"squared_list\"** that receives a list of integers and returns another list whose elements are the squares of the elements of the first. "
57+
]
58+
},
59+
{
60+
"cell_type": "code",
61+
"execution_count": null,
62+
"metadata": {},
63+
"outputs": [],
64+
"source": []
65+
},
66+
{
67+
"cell_type": "markdown",
68+
"metadata": {},
69+
"source": [
70+
"#### 5) Create a function called **\"descending\"** that receives two lists of integers and returns a single list, which contains all the elements in descending order, and may include repeated elements. "
71+
]
72+
},
73+
{
74+
"cell_type": "code",
75+
"execution_count": null,
76+
"metadata": {},
77+
"outputs": [],
78+
"source": []
79+
},
80+
{
81+
"cell_type": "markdown",
82+
"metadata": {},
83+
"source": [
84+
"#### 6) Create a function called **\"adding\"** that receives a list **A**, and an arbitrary number of integers as input. Return a new list containing the elements of **A** plus the integers passed as input, in the order in which they were given. Here is an example: \n",
85+
"\n",
86+
">```python\n",
87+
">>>> A = [10,20,30]\n",
88+
">>>> adding(A, 4, 10, 50, 1)\n",
89+
"> [10, 20, 30, 4, 10, 50, 1]\n",
90+
"```"
91+
]
92+
},
93+
{
94+
"cell_type": "code",
95+
"execution_count": null,
96+
"metadata": {},
97+
"outputs": [],
98+
"source": []
99+
},
100+
{
101+
"cell_type": "markdown",
102+
"metadata": {},
103+
"source": [
104+
"#### 7) Create a function called **\"intersection\"** that receives two input lists and returns another list with the values that belong to the two lists simultaneously (intersection) without repetition of values and in ascending order. Use only lists (do not use sets); loops and conditionals. See the example: \n",
105+
"\n",
106+
">```python\n",
107+
">>>> A = [-2, 0, 1, 2, 3]\n",
108+
">>>> B = [-1, 2, 3, 6, 8]\n",
109+
">>>> intersection(A,B)\n",
110+
"> [2, 3]\n",
111+
"```"
112+
]
113+
},
114+
{
115+
"cell_type": "code",
116+
"execution_count": null,
117+
"metadata": {},
118+
"outputs": [],
119+
"source": []
120+
},
121+
{
122+
"cell_type": "markdown",
123+
"metadata": {},
124+
"source": [
125+
"#### 8) Create a function called **\"union\"** that receives two input lists and returns another list with the union of the elements of the two received, without repetition of elements and in ascending order. Use only lists (do not use sets); loops and conditionals. See the example: \n",
126+
"\n",
127+
">```python\n",
128+
">>>> A = [-2, 0, 1, 2]\n",
129+
">>>> B = [-1, 1, 2, 10]\n",
130+
">>>> union(A,B)\n",
131+
"> [-2, ,-1, 0, 1, 2, 10]\n",
132+
"```"
133+
]
134+
},
135+
{
136+
"cell_type": "code",
137+
"execution_count": null,
138+
"metadata": {},
139+
"outputs": [],
140+
"source": []
141+
},
142+
{
143+
"cell_type": "markdown",
144+
"metadata": {},
145+
"source": [
146+
"#### 9) Generalize the **\"intersection\"** function so that it receives an indefinite number of lists and returns the intersection of all of them. Call the new function **intersection2**. "
147+
]
148+
},
149+
{
150+
"cell_type": "code",
151+
"execution_count": null,
152+
"metadata": {},
153+
"outputs": [],
154+
"source": []
155+
},
156+
{
157+
"cell_type": "markdown",
158+
"metadata": {},
159+
"source": [
160+
"## Challenge\n",
161+
"\n",
162+
"#### 10) Create a function named **\"matrix\"** that implements matrix multiplication:\n",
163+
" \n",
164+
"Given the matrices:\n",
165+
" \n",
166+
"$A_{m\\times n}=\n",
167+
"\\left[\\begin{matrix}\n",
168+
"a_{11}&a_{12}&...&a_{1n}\\\\\n",
169+
"a_{21}&a_{22}&...&a_{2n}\\\\\n",
170+
"\\vdots &\\vdots &&\\vdots\\\\\n",
171+
"a_{m1}&a_{m2}&...&a_{mn}\\\\\n",
172+
"\\end{matrix}\\right]$\n",
173+
" \n",
174+
"We will represent then as a list of lists.\n",
175+
"\n",
176+
"$A = [[a_{11},a_{12},...,a_{1n}],[a_{21},a_{22},...,a_{2n}], . . . ,[a_{m1},a_{m2},...,a_{mn}]]$\n",
177+
"\n",
178+
"The **\"matrix\"** funtion must receive two matrices $A$ e $B$ in the specified format and return $A\\times B$"
179+
]
180+
},
181+
{
182+
"cell_type": "code",
183+
"execution_count": null,
184+
"metadata": {},
185+
"outputs": [],
186+
"source": []
187+
}
188+
],
189+
"metadata": {
190+
"kernelspec": {
191+
"display_name": "Python 3",
192+
"language": "python",
193+
"name": "python3"
194+
},
195+
"language_info": {
196+
"codemirror_mode": {
197+
"name": "ipython",
198+
"version": 3
199+
},
200+
"file_extension": ".py",
201+
"mimetype": "text/x-python",
202+
"name": "python",
203+
"nbconvert_exporter": "python",
204+
"pygments_lexer": "ipython3",
205+
"version": "3.8.5"
206+
}
207+
},
208+
"nbformat": 4,
209+
"nbformat_minor": 4
210+
}

0 commit comments

Comments
 (0)