מפגש 1: התקנה, טרמינל והתוכנית הראשונהSession 1: setup, terminal and the first program
ברוכים הבאים. מציגים את עצמכם ושואלים מי כתב פעם שורת קוד. מרגיעים: לא צריך ידע קודם בכלל.Welcome. Introduce yourself and ask who has ever written code. Reassure: no prior knowledge needed at all.
מה נעשה היוםToday's plan
מה זה תכנות ולמה PythonWhat programming is and why Python
מתקינים Python ו-VS CodeInstall Python and VS Code
מכירים את הטרמינלMeet the terminal
כותבים ומריצים תוכנית ראשונהWrite and run a first program
קוראים שגיאה בלי פאניקהRead an error without panic
מראים את סדר היום. מדגישים שבסוף המפגש לכל אחד תהיה תוכנית שרצה אצלו במחשב.Show the agenda. Stress that by the end everyone will have a program running on their own computer.
המטרה של הקורסThe goal of the course
מהשורה הראשונה ועד פרויקטים אמיתיים וראיון עבודה ראשוןFrom your first line to real projects and a first job interview
מספרים על הפרויקט המלווה (מדף) ועל חלק 7 של משחקים.Mention the companion project (Shelf) and part 7 with games.
נושאTopic 1
מה זה תכנות?What is programming?
מחשב לא מנחשA computer never guesses
עושה בדיוק מה שאומרים לוDoes exactly what it is told
תוכנית = רשימת הוראות לפי הסדרProgram = a list of instructions, in order
תכנות = לכתוב את ההוראות בשפה שהמחשב מביןProgramming = writing those instructions in a language it understands
שואלים את הכיתה: מה ההבדל בין להסביר למחבר לבין להסביר למחשב? (המחשב לא משלים פערים.)Ask: what's the difference between explaining to a friend and to a computer? (The computer fills no gaps.)
רובוט-שףThe robot chef
מתכון = תוכנית. הרובוט מבצע כל צעד בדיוק. כתבתם "ביצם" במקום "ביצים"? הוא עוצר ואומר "לא הבנתי".Recipe = program. The robot does each step exactly. Wrote "egs" instead of "eggs"? It stops and says "I didn't understand".
האנלוגיה הזו תחזור כל הקורס. כדאי לבקש מתלמיד לתת "הוראות" לפעולה פשוטה ולבצע אותן באופן מילולי.This analogy returns all course long. Ask a student to give "instructions" for a simple action and follow them literally.
התוכנית הראשונהThe first program
hello.py
print("שלום! התוכנית הראשונה שלי")
print("Python רצה שורה אחרי שורה")
print("Hello! My first program")
print("Python runs line by line")
פלטOutput
שלום! התוכנית הראשונה שלי
Python רצה שורה אחרי שורה
Hello! My first program
Python runs line by line
מראים שהפלט הוא בדיוק הטקסט בתוך המירכאות, בלי המירכאות עצמן.Show that the output is exactly the text inside the quotes, without the quotes.
P גדולה = מילה אחרתCapital P = a different word
hello.py
Print("שלום")
Print("Hello")
מה Python עונהWhat Python says
NameError: name 'Print' is not defined. Did you mean: 'print'?
Python רגישה לאותיות גדולות וקטנות. מתקנים ל-print.Python is case-sensitive. Fix it to print.
מדגישים שהודעת השגיאה אפילו מציעה את התיקון. שגיאות הן עזרה.Point out that the error even suggests the fix. Errors are help.
נושאTopic 2
למה Python?Why Python?
Python בכל מקוםPython everywhere
אוטומציה של משימותAutomating tasks
נתונים וגרפיםData and charts
אתרים ו-APIWebsites and APIs
AI ומודלי שפהAI and language models
משחקים (חלק 7!)Games (part 7!)
שואלים מה כל אחד רוצה לבנות. רושמים על הלוח, ונחזור לזה בפרויקט הגמר.Ask what each person wants to build. Write it down; we come back to it in the final project.
המפרש = מתורגמןThe interpreter = a translator
המפרש שומע שורה, מתרגם אותה למחשב, והמחשב מבצע. ואז השורה הבאה.The interpreter hears a line, translates it for the computer, the computer acts. Then the next line.
מסבירים שכשמתקינים Python מתקינים את המפרש.Explain that installing Python means installing the interpreter.
מירכאות משנות הכולQuotes change everything
quotes.py
print(2+3)
print("2 + 3")
פלטOutput
5
2 + 3
לפני שמריצים, שואלים את הכיתה מה כל שורה תדפיס.Before running, ask the class what each line will print.
חישוב חצי גמורA half-written calculation
quotes.py
print(2+)
מה Python עונהWhat Python says
SyntaxError: invalid syntax
SyntaxError = השורה לא לפי חוקי השפה. משלימים את החישוב.SyntaxError = the line breaks the language rules. Finish the calculation.
מראים את החץ ^ ומסבירים שהוא מצביע בערך, לא תמיד בדיוק.Show the ^ and explain it points roughly, not always exactly.
נושאTopic 3
התקנת PythonInstalling Python
WindowsWindows
מורידים מ-python.orgDownload from python.org
מסמנים Add python.exe to PATHTick Add python.exe to PATH
עוברים בין התלמידים ובודקים שכולם סימנו את PATH. זו הבעיה מספר 1 בהתקנה.Walk around and check everyone ticked PATH. It is installation problem number 1.
MacMac
מורידים מ-python.org ומתקינים את ה-.pkgDownload from python.org and install the .pkg
לוחצים פעמיים על Install Certificates.commandDouble-click Install Certificates.command
מזכירים: ב-Mac python לבד בדרך כלל לא קיים. זה תקין.Remind: on a Mac plain python usually doesn't exist. That's normal.
בודקים שהכול עובדCheck that it works
Terminal
python3 --version
פלט לדוגמהSample output
Python 3.13.18
כל גרסה 3.12 ומעלה מתאימה.Any version 3.12 or newer is fine.
"python is not recognized""python is not recognized"
ב-Windows: לא סימנו PATH. מריצים שוב את ההתקנה → Modify, או מנסים py --version.On Windows: PATH wasn't ticked. Run the installer again → Modify, or try py --version.
מראים את המדריך הטכני של המפגש, שם יש טבלת פתרון בעיות.Show the session's tech guide, which has a troubleshooting table.
הפסקהBreak
10 דקות. מי שההתקנה לא עבדה לו, בואו אליי.10 minutes. If your install didn't work, come see me.
זמן טוב לעזור בהתקנות תקועות.Good time to help with stuck installs.
נושאTopic 4
הטרמינלThe terminal
מה זה טרמינל?What is a terminal?
חלון שמקלידים בו פקודותA window where you type commands
תמיד עומד בתיקייה נוכחית אחתAlways stands in one current directory
פותחים טרמינל אמיתי על המקרן ומראים שזה רק חלון טקסט.Open a real terminal on the projector and show it's just a text window.
5 פקודות שמספיקות5 commands are enough
MacMac
pwd
ls
cd folder
cd ..
mkdir name
WindowsWindows
pwd
dir
cd folder
cd ..
mkdir name
מתרגלים יחד: כל אחד מקליד pwd ו-ls/dir.Practise together: everyone types pwd and ls/dir.
לנווט בבנייןMoving through a building
pwd = באיזה חדר אני · ls = מה בחדר · cd = להיכנס לדלת · cd .. = לצאת למסדרוןpwd = which room am I in · ls = what's in it · cd = go through a door · cd .. = back to the hallway
אפשר לצייר על הלוח עץ תיקיות פשוט.Draw a simple folder tree on the board.
יוצרים את תיקיית הקורסCreate the course folder
Terminal
cd Desktop
mkdir python-course
cd python-course
pwd
כל אחד יוצר את התיקייה אצלו. בה נשמור את כל הקבצים של הקורס.Everyone creates the folder. We keep all course files there.
שאלה לכיתהQuestion for the class
אתם ב-Desktop. איך נכנסים ל-python-course ואז חוזרים?You're in Desktop. How do you enter python-course and come back?
cd python-course ואז cd ..cd python-course then cd ..
open python-course ואז backopen python-course then back
go python-course ואז exitgo python-course then exit
התשובה: הראשונה. exit סוגר את הטרמינל כולו!Answer: the first. exit closes the whole terminal!
No such file or directoryNo such file or directory
Python מחפשת את הקובץ רק בתיקייה הנוכחית. בודקים pwd ו-ls, ואת האיות של השם.Python only looks in the current folder. Check pwd, ls and the spelling of the name.
מדגימים בכוונה הרצה מהתיקייה הלא נכונה.Demonstrate running from the wrong folder on purpose.
נושאTopic 5
VS CodeVS Code
מכינים את VS CodeSetting up VS Code
מתקינים מ-code.visualstudio.comInstall from code.visualstudio.com
תוסף Python של MicrosoftThe Python extension by Microsoft
File → Open Folder → python-courseFile → Open Folder → python-course
קובץ חדש: hello.pyNew file: hello.py
מראים איפה כפתור ה-▶ ואיפה חלונית הטרמינל.Show where the ▶ button and the terminal panel are.
hello.pyhello.py
hello.py
print("שלום מ-VS Code!")
print("הקובץ הזה הוא סקריפט")
print("כל הכבוד לי!")
print("Hello from VS Code!")
print("This file is a script")
print("Well done, me!")
פלטOutput
שלום מ-VS Code!
הקובץ הזה הוא סקריפט
כל הכבוד לי!
Hello from VS Code!
This file is a script
Well done, me!
כולם מקלידים ומריצים. חוגגים את ההצלחה הראשונה!Everyone types and runs. Celebrate the first success!
שמירה אוטומטיתAuto Save
File → Auto Save. Python מריצה את מה ששמור בדיסק, לא את מה שעל המסך.File → Auto Save. Python runs what's saved on disk, not what's on screen.
הנקודה הלבנה בלשונית = לא נשמר.The white dot in the tab = not saved.
נושאTopic 6
printprint
print היא פונקציהprint is a function
פעולה עם שם, מפעילים עם סוגרייםA named action, run with parentheses
טקסט במירכאות = מחרוזתText in quotes = a string
כמה ערכים? מפרידים בפסיקSeveral values? Separate with commas
print() ריקה = שורה ריקהAn empty print() = a blank line
בהרצאה יש סימולציה שמראה את ההרצה שורה אחרי שורה. כדאי להציג אותה עכשיו.The lecture has a simulation of line-by-line execution. Show it now.
כמה דברים ביחדSeveral things at once
print_demo.py
print("2 + 3 =", 2+3)
print("להתראות", "👋")
print("2 + 3 =", 2+3)
print("Bye", "👋")
פלטOutput
2 + 3 = 5
להתראות 👋
2 + 3 = 5
Bye 👋
שימו לב לרווח ש-print מוסיפה בין הערכים.Note the space print adds between values.
מירכאות שלא נסגרוUnclosed quotes
hello.py
print("שלום)
print("Hello)
מה Python עונהWhat Python says
SyntaxError: unterminated string literal (detected at line 1)
תמיד שתי מירכאות: בהתחלה ובסוף.Always two quotes: at the start and at the end.
VS Code צובע את כל השורה בצבע של מחרוזת. זה רמז ויזואלי טוב.VS Code colours the whole line as a string. A good visual hint.
עוברים על כל אופרטור. ** הוא חזקה.Go through each operator. ** is power.
7 עוגיות, 2 ילדים7 cookies, 2 kids
כל ילד מקבל 7 // 2 = 3, ונשארת 7 % 2 = 1.Each kid gets 7 // 2 = 3, and 7 % 2 = 1 is left.
שואלים: כמה שבועות מלאים יש ב-30 ימים, וכמה ימים נשארים? (30 // 7, 30 % 7)Ask: how many full weeks in 30 days, and how many days left? (30 // 7, 30 % 7)
סדר פעולותOrder of operations
calc.py
print(2+3*4)
print((2+3) *4)
פלטOutput
14
20
כמו בבית הספר: כפל לפני חיבור, סוגריים קודם.Like in school: multiply before add, parentheses first.
חילוק באפסDivision by zero
calc.py
print(10/0)
מה Python עונהWhat Python says
ZeroDivisionError: division by zero
אי אפשר לחלק באפס. Python עוצרת את התוכנית.You can't divide by zero. Python stops the program.
במפגש 11 נלמד לתפוס שגיאות כאלה.In session 11 we learn to catch such errors.