נבנה על ידיBuilt by Ariel Yohimovich

PythonPython
5
חלקPart 1: יסודותFoundations כ-3 שעות (כולל הפסקה)About 3 hours (with a break)

תנאיםConditions

if, elif, else, השוואות, and/or/not ואמת/שקר.

if, elif, else, comparisons, and/or/not and truthiness.

נסו לפתור לבד לפני שמציצים. בנגן: חיצים במקלדת או הכפתורים. כל צעד מראה איפה (קובץ ושורה), מה כותבים ולמה.Try on your own before peeking. In the player use the arrow keys or the buttons. Each step shows where (file and line), what to write, and why.
תרגילExercise 1

זוגי או אי-זוגיEven or odd

תזכורת: מה ביקשוReminder: the task

קלטו מספר שלם והדפיסו even אם הוא זוגי ו-odd אם לא.

Read a whole number and print even if it's even, odd otherwise.

סרטון מונפש: על מה לוחצים, מה כותבים ולמה, צעד אחר צעד.An animated movie: what to click, what to type and why, step by step.
איפהWhere
מהWhat
למהWhy
הפתרון המלא והפלט שלוFull solution and its output
main.py
n = int(input())
if n % 2 == 0:
    print("even")
else:
    print("odd")
פלטOutput
7
odd

יש יותר מדרך נכונה אחת. אם הפלט שלכם זהה, גם הפתרון שלכם נכון.There is more than one right way. If your output matches, your solution is right too.

תרגילExercise 2

ציון במיליםGrade in words

תזכורת: מה ביקשוReminder: the task

קלטו ציון (0-100) והדפיסו: 90+ excellent, 75-89 good, 55-74 pass, מתחת fail.

Read a score (0-100) and print: 90+ excellent, 75-89 good, 55-74 pass, below that fail.

סרטון מונפש: על מה לוחצים, מה כותבים ולמה, צעד אחר צעד.An animated movie: what to click, what to type and why, step by step.
איפהWhere
מהWhat
למהWhy
הפתרון המלא והפלט שלוFull solution and its output
main.py
s = int(input())
if s >= 90:
    print("excellent")
elif s >= 75:
    print("good")
elif s >= 55:
    print("pass")
else:
    print("fail")
פלטOutput
82
good

יש יותר מדרך נכונה אחת. אם הפלט שלכם זהה, גם הפתרון שלכם נכון.There is more than one right way. If your output matches, your solution is right too.

תרגילExercise 3

שנה מעוברתLeap year

תזכורת: מה ביקשוReminder: the task

קלטו שנה והדפיסו True אם היא מעוברת: מתחלקת ב-4, אבל לא ב-100, אלא אם היא מתחלקת ב-400.

Read a year and print True if it's a leap year: divisible by 4, but not by 100, unless divisible by 400.

סרטון מונפש: על מה לוחצים, מה כותבים ולמה, צעד אחר צעד.An animated movie: what to click, what to type and why, step by step.
איפהWhere
מהWhat
למהWhy
הפתרון המלא והפלט שלוFull solution and its output
main.py
y = int(input())
leap = (y % 4 == 0 and y % 100 != 0) or y % 400 == 0
print(leap)
פלטOutput
2000
True

יש יותר מדרך נכונה אחת. אם הפלט שלכם זהה, גם הפתרון שלכם נכון.There is more than one right way. If your output matches, your solution is right too.

תרגילExercise 4

כניסה למערכתLog in

תזכורת: מה ביקשוReminder: the task

משתמש נכון: admin, סיסמה נכונה: py123. קלטו שם וסיסמה. אם שניהם נכונים הדפיסו welcome; אם רק השם נכון wrong password; אחרת unknown user.

Correct user: admin, password: py123. Read a name and password. If both are right print welcome; if only the name is right wrong password; otherwise unknown user.

סרטון מונפש: על מה לוחצים, מה כותבים ולמה, צעד אחר צעד.An animated movie: what to click, what to type and why, step by step.
איפהWhere
מהWhat
למהWhy
הפתרון המלא והפלט שלוFull solution and its output
main.py
user = input()
pw = input()
if user == "admin":
    if pw == "py123":
        print("welcome")
    else:
        print("wrong password")
else:
    print("unknown user")
פלטOutput
admin
abc
wrong password

יש יותר מדרך נכונה אחת. אם הפלט שלכם זהה, גם הפתרון שלכם נכון.There is more than one right way. If your output matches, your solution is right too.

תרגילExercise 5

מדף, צעד 5: תגית לספרShelf, step 5: tag a book

תזכורת: מה ביקשוReminder: the task

קלטו שם ספר, מספר עמודים ודירוג (1-5). הדפיסו <שם>: ואחריו תגית: ⭐ must read אם הדירוג 5, 📏 long אם יותר מ-500 עמודים (ודירוג פחות מ-5), אחרת 📖 regular.

Read a title, page count and rating (1-5). Print <title>: followed by a tag: ⭐ must read if rating is 5, 📏 long if over 500 pages (and rating under 5), otherwise 📖 regular.

סרטון מונפש: על מה לוחצים, מה כותבים ולמה, צעד אחר צעד.An animated movie: what to click, what to type and why, step by step.
איפהWhere
מהWhat
למהWhy
הפתרון המלא והפלט שלוFull solution and its output
shelf.py
title = input()
pages = int(input())
rating = int(input())
if rating == 5:
    tag = "⭐ must read"
elif pages > 500:
    tag = "📏 long"
else:
    tag = "📖 regular"
print(f"{title}: {tag}")
פלטOutput
Dune
600
4
Dune: 📏 long

יש יותר מדרך נכונה אחת. אם הפלט שלכם זהה, גם הפתרון שלכם נכון.There is more than one right way. If your output matches, your solution is right too.

אתגרChallenge 1

סוג משולשTriangle type

תזכורת: מה ביקשוReminder: the task

קלטו שלוש צלעות. אם הן לא יכולות ליצור משולש (צלע אחת ≥ סכום שתי האחרות) הדפיסו invalid. אחרת: equilateral (שלוש שוות), isosceles (שתיים), scalene (אף אחת).

Read three sides. If they can't form a triangle (one side ≥ the sum of the other two) print invalid. Otherwise: equilateral (all equal), isosceles (two), scalene (none).

סרטון מונפש: על מה לוחצים, מה כותבים ולמה, צעד אחר צעד.An animated movie: what to click, what to type and why, step by step.
איפהWhere
מהWhat
למהWhy
הפתרון המלא והפלט שלוFull solution and its output
main.py
a = int(input())
b = int(input())
c = int(input())
if a >= b + c or b >= a + c or c >= a + b:
    print("invalid")
elif a == b == c:
    print("equilateral")
elif a == b or b == c or a == c:
    print("isosceles")
else:
    print("scalene")
פלטOutput
5
5
8
isosceles

יש יותר מדרך נכונה אחת. אם הפלט שלכם זהה, גם הפתרון שלכם נכון.There is more than one right way. If your output matches, your solution is right too.

אתגרChallenge 2

אבן, נייר, מספרייםRock, paper, scissors

תזכורת: מה ביקשוReminder: the task

קלטו שתי בחירות (rock / paper / scissors) של שחקן 1 ושחקן 2. הדפיסו tie, player 1 או player 2 לפי המנצח.

Read two choices (rock / paper / scissors) for player 1 and player 2. Print tie, player 1 or player 2 for the winner.

סרטון מונפש: על מה לוחצים, מה כותבים ולמה, צעד אחר צעד.An animated movie: what to click, what to type and why, step by step.
איפהWhere
מהWhat
למהWhy
הפתרון המלא והפלט שלוFull solution and its output
main.py
p1 = input().strip().lower()
p2 = input().strip().lower()
if p1 == p2:
    print("tie")
elif (p1 == "rock" and p2 == "scissors") or (p1 == "scissors" and p2 == "paper") or (p1 == "paper" and p2 == "rock"):
    print("player 1")
else:
    print("player 2")
פלטOutput
Rock
paper
player 2

יש יותר מדרך נכונה אחת. אם הפלט שלכם זהה, גם הפתרון שלכם נכון.There is more than one right way. If your output matches, your solution is right too.

נבנה על ידיBuilt by Ariel Yohimovich