Skip to content

Commit cd88338

Browse files
committed
Uploading Labs
1 parent ea04f4c commit cd88338

File tree

1 file changed

+72
-20
lines changed

1 file changed

+72
-20
lines changed

your-code/main.ipynb

Lines changed: 72 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
},
2222
{
2323
"cell_type": "code",
24-
"execution_count": 1,
24+
"execution_count": 12,
2525
"metadata": {},
2626
"outputs": [],
2727
"source": [
@@ -32,7 +32,7 @@
3232
" \"\"\"\n",
3333
" \n",
3434
" # your code here\n",
35-
" "
35+
" return [lmbda(x) for x in lst]\n"
3636
]
3737
},
3838
{
@@ -46,11 +46,12 @@
4646
},
4747
{
4848
"cell_type": "code",
49-
"execution_count": 3,
49+
"execution_count": 13,
5050
"metadata": {},
5151
"outputs": [],
5252
"source": [
53-
"# your code here"
53+
"# your code here\n",
54+
"celsius_conv = lambda c: c + 273.15"
5455
]
5556
},
5657
{
@@ -62,13 +63,25 @@
6263
},
6364
{
6465
"cell_type": "code",
65-
"execution_count": 4,
66+
"execution_count": 14,
6667
"metadata": {},
67-
"outputs": [],
68+
"outputs": [
69+
{
70+
"data": {
71+
"text/plain": [
72+
"[285.15, 296.15, 311.15, 218.14999999999998, 297.15]"
73+
]
74+
},
75+
"execution_count": 14,
76+
"metadata": {},
77+
"output_type": "execute_result"
78+
}
79+
],
6880
"source": [
6981
"temps = [12, 23, 38, -55, 24]\n",
7082
"\n",
71-
"# your code here"
83+
"# your code here\n",
84+
"modify_list(temps, celsius_conv)"
7285
]
7386
},
7487
{
@@ -86,7 +99,8 @@
8699
"metadata": {},
87100
"outputs": [],
88101
"source": [
89-
"# your code here"
102+
"# your code here\n",
103+
"mod=lambda x,y: 1 if x % y == 0 else 0"
90104
]
91105
},
92106
{
@@ -100,7 +114,7 @@
100114
},
101115
{
102116
"cell_type": "code",
103-
"execution_count": 6,
117+
"execution_count": 18,
104118
"metadata": {},
105119
"outputs": [],
106120
"source": [
@@ -111,7 +125,8 @@
111125
" divisible by another number (to be passed later) and zero otherwise.\n",
112126
" \"\"\"\n",
113127
" \n",
114-
" # your code here"
128+
" # your code here\n",
129+
" return lambda x: 1 if x % b == 0 else 0"
115130
]
116131
},
117132
{
@@ -123,11 +138,12 @@
123138
},
124139
{
125140
"cell_type": "code",
126-
"execution_count": 7,
141+
"execution_count": 19,
127142
"metadata": {},
128143
"outputs": [],
129144
"source": [
130-
"# your code here"
145+
"# your code here\n",
146+
"divisible5 = divisor(5)"
131147
]
132148
},
133149
{
@@ -139,18 +155,41 @@
139155
},
140156
{
141157
"cell_type": "code",
142-
"execution_count": null,
158+
"execution_count": 20,
143159
"metadata": {},
144-
"outputs": [],
160+
"outputs": [
161+
{
162+
"data": {
163+
"text/plain": [
164+
"1"
165+
]
166+
},
167+
"execution_count": 20,
168+
"metadata": {},
169+
"output_type": "execute_result"
170+
}
171+
],
145172
"source": [
173+
"divisible5 = divisor(5)\n",
146174
"divisible5(10)"
147175
]
148176
},
149177
{
150178
"cell_type": "code",
151-
"execution_count": null,
179+
"execution_count": 21,
152180
"metadata": {},
153-
"outputs": [],
181+
"outputs": [
182+
{
183+
"data": {
184+
"text/plain": [
185+
"0"
186+
]
187+
},
188+
"execution_count": 21,
189+
"metadata": {},
190+
"output_type": "execute_result"
191+
}
192+
],
154193
"source": [
155194
"divisible5(8)"
156195
]
@@ -199,14 +238,27 @@
199238
},
200239
{
201240
"cell_type": "code",
202-
"execution_count": 11,
241+
"execution_count": 23,
203242
"metadata": {},
204-
"outputs": [],
243+
"outputs": [
244+
{
245+
"data": {
246+
"text/plain": [
247+
"['Green eggs', 'cheese', 'English cucumber', 'tomato']"
248+
]
249+
},
250+
"execution_count": 23,
251+
"metadata": {},
252+
"output_type": "execute_result"
253+
}
254+
],
205255
"source": [
206256
"list1 = ['Green', 'cheese', 'English', 'tomato']\n",
207257
"list2 = ['eggs', 'cheese', 'cucumber', 'tomato']\n",
208258
"\n",
209-
"# your code here"
259+
"# your code here\n",
260+
"comb_strings_spaces = lambda a, b: a + ' ' + b if a != b else a\n",
261+
"[comb_strings_spaces(a, b) for (a, b) in zip(list1, list2)]"
210262
]
211263
},
212264
{
@@ -269,7 +321,7 @@
269321
"name": "python",
270322
"nbconvert_exporter": "python",
271323
"pygments_lexer": "ipython3",
272-
"version": "3.7.2"
324+
"version": "3.8.3"
273325
}
274326
},
275327
"nbformat": 4,

0 commit comments

Comments
 (0)