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

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

מחרוזותStrings

אינדקסים, חיתוך, מתודות של מחרוזות ועיצוב פלט.

Indexing, slicing, string methods and formatting output.

נסו לפתור לבד לפני שמציצים. בנגן: חיצים במקלדת או הכפתורים. כל צעד מראה איפה (קובץ ושורה), מה כותבים ולמה.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

ראשי תיבותInitials

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

קלטו שם פרטי ושם משפחה (שתי שורות) והדפיסו ראשי תיבות באותיות גדולות עם נקודות, למשל N.L.

Read a first and last name (two lines) and print uppercase initials with dots, e.g. N.L.

סרטון מונפש: על מה לוחצים, מה כותבים ולמה, צעד אחר צעד.An animated movie: what to click, what to type and why, step by step.
איפהWhere
מהWhat
למהWhy
הפתרון המלא והפלט שלוFull solution and its output
main.py
first = input()
last = input()
print(f"{first[0]}.{last[0]}.".upper())
פלטOutput
noa
levi
N.L.

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

תרגילExercise 2

ניקוי שם ספרClean a book title

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

קלטו שם ספר שהוקלד ברישול (רווחים בקצוות, אותיות מעורבבות). הדפיסו אותו נקי: בלי רווחים בקצוות, כל מילה באות גדולה.

Read a sloppily typed book title (spaces at the ends, mixed case). Print it clean: no spaces at the ends, each word capitalised.

סרטון מונפש: על מה לוחצים, מה כותבים ולמה, צעד אחר צעד.An animated movie: what to click, what to type and why, step by step.
איפהWhere
מהWhat
למהWhy
הפתרון המלא והפלט שלוFull solution and its output
main.py
raw = input()
print(raw.strip().title())
פלטOutput
   tHE liTTle PRINCE   
The Little Prince

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

תרגילExercise 3

פלינדרוםPalindrome

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

קלטו מילה והדפיסו True אם היא נקראת אותו דבר משני הכיוונים (בלי להתחשב באותיות גדולות), אחרת False.

Read a word and print True if it reads the same both ways (ignoring case), otherwise False.

סרטון מונפש: על מה לוחצים, מה כותבים ולמה, צעד אחר צעד.An animated movie: what to click, what to type and why, step by step.
איפהWhere
מהWhat
למהWhy
הפתרון המלא והפלט שלוFull solution and its output
main.py
w = input().lower()
print(w == w[::-1])
פלטOutput
Racecar
True

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

תרגילExercise 4

סופר תנועותVowel counter

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

קלטו משפט באנגלית והדפיסו כמה תנועות (a, e, i, o, u) יש בו, בלי להתחשב באותיות גדולות. בלי לולאות: רק count.

Read an English sentence and print how many vowels (a, e, i, o, u) it has, ignoring case. No loops: just count.

סרטון מונפש: על מה לוחצים, מה כותבים ולמה, צעד אחר צעד.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 = input().lower()
print(s.count("a") + s.count("e") + s.count("i") + s.count("o") + s.count("u"))
פלטOutput
The Little Prince lives on a planet
11

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

תרגילExercise 5

מדף, צעד 4: שורת ספר מיושרתShelf, step 4: an aligned book row

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

קלטו שם ספר (מלוכלך) ומספר עמודים. נקו את השם (strip + title) והדפיסו שורה אחת: השם מיושר לשמאל ברוחב 20, |, ומספר העמודים מיושר לימין ברוחב 5.

Read a (messy) book title and a page count. Clean the title (strip + title) and print one row: the title left-aligned in 20 characters, |, and the pages right-aligned in 5.

סרטון מונפש: על מה לוחצים, מה כותבים ולמה, צעד אחר צעד.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().strip().title()
pages = int(input())
print(f"{title:<20}|{pages:>5}")
פלטOutput
  dune 
412
Dune                |  412

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

אתגרChallenge 1

הסתרת אימיילMask an email

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

קלטו כתובת אימייל והדפיסו אותה מוסתרת: התו הראשון, אחריו ***, ואז מה-@ והלאה. noa.levi@example.com → n***@example.com.

Read an email and print it masked: the first character, then ***, then from @ onwards. noa.levi@example.com → n***@example.com.

סרטון מונפש: על מה לוחצים, מה כותבים ולמה, צעד אחר צעד.An animated movie: what to click, what to type and why, step by step.
איפהWhere
מהWhat
למהWhy
הפתרון המלא והפלט שלוFull solution and its output
main.py
email = input().strip()
at = email.find("@")
print(email[0] + "***" + email[at:])
פלטOutput
noa.levi@example.com
n***@example.com

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

אתגרChallenge 2

מילים הפוכותReverse the words

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

קלטו משפט והדפיסו את המילים בסדר הפוך (לא את האותיות). I love good books → books good love I.

Read a sentence and print its words in reverse order (not the letters). I love good books → books good love I.

סרטון מונפש: על מה לוחצים, מה כותבים ולמה, צעד אחר צעד.An animated movie: what to click, what to type and why, step by step.
איפהWhere
מהWhat
למהWhy
הפתרון המלא והפלט שלוFull solution and its output
main.py
words = input().split()
print(" ".join(words[::-1]))
פלטOutput
I love good books
books good love I

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

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