-
Notifications
You must be signed in to change notification settings - Fork 218
Upload the first 2 notebooks of the first week #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
1 change: 1 addition & 0 deletions
.gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.ipynb_checkpoints |
333 changes: 333 additions & 0 deletions
week1/1_Strings_and_Output.ipynb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,333 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<img src=\"images/logo.png\" alt=\"לוגו של מיזם לימוד הפייתון. נחש מצויר בצבעי צהוב וכחול, הנע בין האותיות של שם הקורס: לומדים פייתון. הסלוגן המופיע מעל לשם הקורס הוא מיזם לימוד תכנות בחינם ובעברית.\">" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# <p style=\"align: right; direction: rtl; float: right;\">ברוכים הבאים למחברת הפייתון הראשונה שלכם!</p>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<p style=\"text-align: right; direction: rtl; float: right;\">על־מנת להריץ את התוכן של תא מסוים, לחצו עליו כך שתופיע מסביבו מסגרת, והקישו על המקשים <kbd>CTRL</kbd> + <kbd>ENTER</kbd> במקלדת יחד.<br>\n", | ||
"לאחר שתעשו זאת, פייתון יעבד את הביטוי המופיע במשבצת ויציג לכם תשובה בהתאם.<br>\n", | ||
"נסו את זה על המשבצת הבאה!</p>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"print(\"Hello World\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<p style=\"text-align: right; direction: rtl; float: right;\">אפשר לזהות תא שמיועד להרצה בקלות, באמצעות צבע הרקע האפור שלו.</p>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<p style=\"text-align: right; direction: rtl; float: right; /*border: 1px dotted; padding: 1.5rem*/\"><img src=\"images/tip.png\" style=\"display: inline; height: 50px !important; margin-left: 2rem\" alt=\"טיפ!\"> \n", | ||
"תוכלו להמנע משימוש בעכבר ולעבוד מהר יותר רק עם המקלדת. עברו בין התאים בעזרת המקשים <kbd>↓</kbd> או <kbd>↑</kbd> במקלדת שלכם.\n", | ||
"</p>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## <p style=\"align: right; direction: rtl; float: right;\">הדפסה</p>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<p style=\"text-align: right; direction: rtl; float: right;\">\n", | ||
"<q>אבל רגע</q>, יגידו הסקרנים ביניכם.\n", | ||
"<q>מה הרצתי שם למעלה?</q>.<br>\n", | ||
"\n", | ||
"בגדול, כמו שבוודאי ניחשת, הקוד שהרצת מדפיס \"שלום עולם\". הוא מורכב משני חלקים יחסית פשוטים: *מחרוזת* ו*פקודת הדפסה*.\n", | ||
"</p>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### <p style=\"align: right; direction: rtl; float: right;\">print</p>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<p style=\"text-align: right; direction: rtl; float: right;\">\n", | ||
"אחד מהדברים השימושיים ביותר שנעשה בשבועות הקרובים, זה להדפיס דברים למסך.<br>\n", | ||
"כדי לעשות את זה, כל מה שנצטרך לעשות זה לכתוב `print`, לפתוח סוגריים, לכתוב *ביטוי חוקי כלשהו* ולסגור את הסוגריים.<br>\n", | ||
"בואו נסתכל על כמה דוגמאות:\n", | ||
"</p>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 17, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"1\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print(1)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 18, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Hello\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print(\"Hello\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 19, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Hello World\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print(\"Hello World\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 20, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"6\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print(1 + 5)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<div style=\"width: 10%; text-align: right; direction: rtl; float: right;\">\n", | ||
" <img src=\"images/warning.svg\" style=\"display: flex; align-items: center; justify-content: center; height: 50px !important;\" alt=\"אזהרה!\"> \n", | ||
"</div>\n", | ||
"<div style=\"width: 90%\">\n", | ||
" <p style=\"text-align: right; direction: rtl; float: right;\">\n", | ||
" נהוג לרשום את הסוגריים בסמוך למילה `print`. אם תשכחו סוגריים, או תפתחו סוגריים ותשכחו לסגור אותם, פייתון יתבכיין. זה לא באמת מפחיד אותנו, אבל כדאי לזכור שזו אחת הסיבות שאתם עלולים להתקל בהודעות שגיאה.\n", | ||
" </p>\n", | ||
"</div>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### <p style=\"align: right; direction: rtl; float: right;\">מחרוזת</p>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<p style=\"text-align: right; direction: rtl; float: right;\">\n", | ||
"למרות השם הרשמי, מחרוזת היא בסך הכל רצף של תווים. מחרוזת יכולה להיות \"שלום עולם\", התוכן של הספר \"הארי פוטר\" ואפילו האות \"ש\" לבדה.<br>\n", | ||
"במקרה שלנו, המחרוזת היא `\"Hello World\"`.<br>\n", | ||
"כדי שפייתון יזהה שמדובר במחרוזת, אנחנו נהיה חייבים להקיף את המחרוזת בגרש (צ'וקו) או גרשיים (צ'וקיים). פייתון זורם ולא באמת אכפת לו במה תשתמשו, כל עוד תתחילו ותסיימו את המחרוזת שלכם עם אותו סימן.<br>\n", | ||
"בואו נסתכל על כמה דוגמאות:\n", | ||
"</p>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"print(\"Hello World\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"print('Hello World') # גם צ'וקו עובד!" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"print('Why were you lurking under our window?\" \"Yes - yes, good point, Petunia! What were you doing under our windows, boy?\" \"Listening to the news,\" said Harry in a resigned voice. His aunt and uncle exchanged looks of outrage. \"Listening to the news! Again?\" \"Well, it changes every day, you see,\" said Harry.')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"print(\"x\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<div style=\"width: 10%; text-align: right; direction: rtl; float: right;\">\n", | ||
" <img src=\"images/warning.svg\" style=\"display: flex; align-items: center; justify-content: center; height: 50px !important;\" alt=\"אזהרה!\"> \n", | ||
"</div>\n", | ||
"<div style=\"width: 90%\">\n", | ||
" <p style=\"text-align: right; direction: rtl; float: right;\">\n", | ||
" טעות נפוצה בקרב אנשים שמצטרפים לעולם התכנות, היא לשכוח את הגרש או את הגרשיים בסיום ו/או בתחילת המחרוזת. אם תשכחו אותם, פייתון עלול להתבכיין. זה לא באמת מפחיד אותנו, אבל כדאי לזכור שזו אחת הסיבות שאתם עלולים להתקל בהודעות שגיאה.\n", | ||
" </p>\n", | ||
"</div>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"print(Hello World) # דוגמה להדפסה בלי גרשיים שנכשלת וגורמת לפייתון לבכות" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### <p style=\"align: right; direction: rtl; float: right;\">תרגול: מה מחרוזת ומה לא?</p>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<p style=\"text-align: right; direction: rtl; float: right;\">\n", | ||
"לפניכם כמה ביטויים בפייתון. מה לדעתכם מחרוזת תקינה, ומה לא?<br>\n", | ||
"זהירות! שמנו שם כמה מוקשים ;)\n", | ||
"</p>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<ul style=\"font-size: 1.25em\">\n", | ||
"<li>`\"Hello World\"`</li>\n", | ||
"<li>`'Hello World\"`</li>\n", | ||
"<li>`1234`</li>\n", | ||
"<li>`\"1234\"`</li>\n", | ||
"<li>`print(\"Hello World\")`</li>\n", | ||
"<li>`print`</li>\n", | ||
"<li>`'Israel'`</li>\n", | ||
"<li>`Moshe`</li>\n", | ||
"<li>`\".\"`</li>\n", | ||
"<li>`\"_)(*&^%\"`</li>\n", | ||
"<li>`\"_)('*&^%\"`</li>\n", | ||
"<li>`\"_)(\"*&^%\"`</li>\n", | ||
"</ul>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### <p style=\"align: right; direction: rtl; float: right;\">תרגול: שרה שרה שיר שמח</p>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<p style=\"text-align: right; direction: rtl; float: right;\">\n", | ||
"הדפיסו את הפזמון מהשיר האהוב עליכם!<br>\n", | ||
"על מנת לעשות את זה, לחצו על השטח האפור בתא מלמטה. כתבו שם את הקוד שלכם, ולחצו <kbd>CTRL</kbd> יחד עם <kbd>ENTER</kbd>.\n", | ||
"</p>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python [conda root]", | ||
"language": "python", | ||
"name": "conda-root-py" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.5.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.