Skip to content

Commit 19e98bd

Browse files
committed
Add week6.
1 parent 448e82f commit 19e98bd

38 files changed

+486064
-0
lines changed

week6/1_Sets.ipynb

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

week6/2_Functional_Behavior.ipynb

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

week6/3_Comprehensions.ipynb

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

week6/4_Modules_Part_2.ipynb

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

week6/5_Summary.ipynb

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# <span style=\"align: right; direction: rtl; float: right; clear: both;\">תרגילים</span>"
8+
]
9+
},
10+
{
11+
"cell_type": "markdown",
12+
"metadata": {},
13+
"source": [
14+
"### <span style=\"text-align: right; direction: rtl; float: right; clear: both;\">group_by</span>"
15+
]
16+
},
17+
{
18+
"cell_type": "markdown",
19+
"metadata": {},
20+
"source": [
21+
"<p style=\"text-align: right; direction: rtl; float: right; clear: both;\">\n",
22+
" כתבו פונקציה בשם <var>group_by</var> שמקבלת פונקציה כפרמטר ראשון, ו־iterable כפרמטר שני.<br>\n",
23+
" הפונקציה תחזיר מילון, שבו:\n",
24+
"</p>"
25+
]
26+
},
27+
{
28+
"cell_type": "markdown",
29+
"metadata": {},
30+
"source": [
31+
"<ul style=\"text-align: right; direction: rtl; float: right; clear: both;\">\n",
32+
" <li>המפתחות הם הערכים שחזרו מהפונקציה שהועברה כפרמטר הראשון.</li>\n",
33+
" <li>הערך התואם למפתח מסוים הוא רשימה של כל האיברים שעבורם חזר הערך המופיע במפתח.</li>\n",
34+
"</ul>"
35+
]
36+
},
37+
{
38+
"cell_type": "markdown",
39+
"metadata": {},
40+
"source": [
41+
"<p style=\"text-align: right; direction: rtl; float: right; clear: both;\">\n",
42+
"לדוגמה, עבור הקריאה <code dir=\"ltr\" style=\"direction: ltr; text-align: left;\">group_by(len, [\"hi\", \"bye\", \"yo\", \"try\"])</code> יוחזר הערך: <samp dir=\"ltr\" style=\"direction: ltr; text-align: left;\">{2: [\"hi\", \"yo\"], 3: [\"bye\", \"try\"]}</samp>.\n",
43+
"</p>"
44+
]
45+
},
46+
{
47+
"cell_type": "markdown",
48+
"metadata": {},
49+
"source": [
50+
"### <span style=\"text-align: right; direction: rtl; float: right; clear: both;\">zipwith</span>"
51+
]
52+
},
53+
{
54+
"cell_type": "markdown",
55+
"metadata": {},
56+
"source": [
57+
"<p style=\"text-align: right; direction: rtl; float: right; clear: both;\">\n",
58+
" כתבו פונקציה בשם <var>zip_with</var> שמקבלת פונקציה כפרמטר ראשון, ושני iterable־ים או יותר בפרמטרים שאחריו.<br>\n",
59+
" הפונקציה תחזיר רשימה, שבה האיבר במקום ה־N־י הוא הערך שחזר מהעברת כל הערכים במקום ה־N־י של כל ה־iterables לפונקציה.\n",
60+
"</p>"
61+
]
62+
},
63+
{
64+
"cell_type": "markdown",
65+
"metadata": {},
66+
"source": [
67+
"<p style=\"text-align: right; direction: rtl; float: right; clear: both;\">\n",
68+
"לדוגמה:\n",
69+
"</p>"
70+
]
71+
},
72+
{
73+
"cell_type": "markdown",
74+
"metadata": {},
75+
"source": [
76+
"<ul style=\"text-align: right; direction: rtl; float: right; clear: both;\">\n",
77+
" <li>עבור הקריאה <code dir=\"ltr\" style=\"direction: ltr; text-align: left;\">zipwith(add, [1, 2, 3], [4, 5, 6])</code> יוחזר הערך: <samp dir=\"ltr\" style=\"direction: ltr; text-align: left;\">[5, 7, 9]</samp>.</li>\n",
78+
" <li>עבור הקריאה <code dir=\"ltr\" style=\"direction: ltr; text-align: left;\">zipwith(max, (5, 4), (2, 5), (6, -6))</code> יוחזר הערך: <samp dir=\"ltr\" style=\"direction: ltr; text-align: left;\">[6, 5]</samp>.</li>\n",
79+
"</ul>"
80+
]
81+
},
82+
{
83+
"cell_type": "markdown",
84+
"metadata": {},
85+
"source": [
86+
"<p style=\"text-align: right; direction: rtl; float: right; clear: both;\">\n",
87+
" אפשר להניח שה־iterables המועברים לפונקציה זהים באורכם.\n",
88+
"</p>"
89+
]
90+
},
91+
{
92+
"cell_type": "markdown",
93+
"metadata": {},
94+
"source": [
95+
"### <span style=\"text-align: right; direction: rtl; float: right; clear: both;\">זכרתם?</span>\n"
96+
]
97+
},
98+
{
99+
"cell_type": "markdown",
100+
"metadata": {},
101+
"source": [
102+
"<p style=\"text-align: right; direction: rtl; float: right; clear: both;\">\n",
103+
" כתבו פונקציה שמקבלת מסר להצפנה, ויוצרת ממנו תמונה מוצפנת.<br>\n",
104+
" השתמשו בשיטת ההצפנה שהוצגה במחברת הקודמת. \n",
105+
"</p>"
106+
]
107+
},
108+
{
109+
"cell_type": "markdown",
110+
"metadata": {},
111+
"source": [
112+
"### <span style=\"text-align: right; direction: rtl; float: right; clear: both;\">סט</span>"
113+
]
114+
},
115+
{
116+
"cell_type": "markdown",
117+
"metadata": {},
118+
"source": [
119+
"<p style=\"text-align: right; direction: rtl; float: right; clear: both;\">\n",
120+
" למדו את החוקים של המשחק סט, <a href=\"https://he.wikipedia.org/wiki/%D7%A1%D7%98_(%D7%9E%D7%A9%D7%97%D7%A7_%D7%A7%D7%9C%D7%A4%D7%99%D7%9D)\">מהערך בוויקיפדיה</a> או מ־<a href=\"https://www.youtube.com/watch?v=Kc4WrL7cxeg\">YouTube</a>.\n",
121+
"</p>"
122+
]
123+
},
124+
{
125+
"cell_type": "markdown",
126+
"metadata": {},
127+
"source": [
128+
"<ol style=\"text-align: right; direction: rtl; float: right; clear: both;\">\n",
129+
" <li>צרו חפיסת סט.</li>\n",
130+
" <li>טרפו אותה היטב, ופתחו 12 קלפים על השולחן. הדפיסו את כל הסטים שמצאתם.</li>\n",
131+
" <li>בדקו בכמה אחוזים מהפעמים שבהן פותחים 12 קלפים אקראיים מהחפיסה – אין אף סט על הלוח.</li>\n",
132+
"</ol>"
133+
]
134+
},
135+
{
136+
"cell_type": "markdown",
137+
"metadata": {},
138+
"source": [
139+
"<p style=\"text-align: right; direction: rtl; float: right; clear: both;\">\n",
140+
" כדי לחשב את סעיף 3, הריצו את הבדיקה על 10,000 מקרים שבהם פתחתם 12 קלפים מהחפיסה המעורבבת.\n",
141+
"</p>"
142+
]
143+
},
144+
{
145+
"cell_type": "markdown",
146+
"metadata": {},
147+
"source": [
148+
"### <span style=\"text-align: right; direction: rtl; float: right; clear: both;\">100 מעלות</span>"
149+
]
150+
},
151+
{
152+
"cell_type": "markdown",
153+
"metadata": {},
154+
"source": [
155+
"<p style=\"text-align: right; direction: rtl; float: right; clear: both;\">\n",
156+
" כתבו קוד שמוצא את 100 השירים הפופולריים ביותר לפי מדד <a href=\"https://www.billboard.com/charts/hot-100\">Hot 100</a> של Billboard.<br>\n",
157+
" השיגו את המילים של השירים שמצאתם, ושרטטו גרף שמראה כמה פעמים מופיעה כל מילה מ־100 המילים הנפוצות ביותר בכל השירים.\n",
158+
"</p>"
159+
]
160+
},
161+
{
162+
"cell_type": "markdown",
163+
"metadata": {},
164+
"source": [
165+
"<p style=\"text-align: right; direction: rtl; float: right; clear: both;\">\n",
166+
" בונוס: בצעו ניתוח מעניין אחר, כמו מיהם האומנים שמשתמשים בהכי הרבה מילים בשירים שלהם!\n",
167+
"</p>"
168+
]
169+
}
170+
],
171+
"metadata": {
172+
"kernelspec": {
173+
"display_name": "Python 3",
174+
"language": "python",
175+
"name": "python3"
176+
},
177+
"language_info": {
178+
"codemirror_mode": {
179+
"name": "ipython",
180+
"version": 3
181+
},
182+
"file_extension": ".py",
183+
"mimetype": "text/x-python",
184+
"name": "python",
185+
"nbconvert_exporter": "python",
186+
"pygments_lexer": "ipython3",
187+
"version": "3.7.6"
188+
}
189+
},
190+
"nbformat": 4,
191+
"nbformat_minor": 4
192+
}

week6/images/deeper.svg

Lines changed: 1 addition & 0 deletions
Loading

week6/images/deeper2.svg

Lines changed: 1 addition & 0 deletions
Loading

week6/images/exercise.svg

Lines changed: 48 additions & 0 deletions
Loading

week6/images/for_vs_listcomp.png

48.3 KB
Loading

0 commit comments

Comments
 (0)