גיל בעוד 10 שניםAge in 10 years
קלטו גיל והדפיסו את הגיל בעוד 10 שנים.
Read an age and print the age in 10 years.
איך הפלט אמור להיראות?What should the output look like?
גיל: 31 41
Age: 31 41
int(input(...))int(input(...))נבנה על ידיBuilt by Ariel Yohimovich
int, float, bool, המרות בין טיפוסים, עיגול, ומה קורה כשמערבבים.
int, float, bool, converting between types, rounding, and what happens when you mix them.
קלטו גיל והדפיסו את הגיל בעוד 10 שנים.
Read an age and print the age in 10 years.
גיל: 31 41
Age: 31 41
int(input(...))int(input(...))קלטו טמפרטורה בצלזיוס (יכולה להיות עשרונית) והדפיסו בפרנהייט, מעוגל לספרה אחת אחרי הנקודה. נוסחה: F = C × 9/5 + 32.
Read a Celsius temperature (may be a decimal) and print it in Fahrenheit, rounded to one decimal. Formula: F = C × 9/5 + 32.
°C: 36.6 97.9
float(input(...))float(input(...))round(f, 1)round(f, 1)הדפיסו את הטיפוס של ארבעה ערכים: 12, 12.0, "12" ו-12 > 5, כל אחד בשורה.
Print the type of four values: 12, 12.0, "12" and 12 > 5, one per line.
<class 'int'> <class 'float'> <class 'str'> <class 'bool'>
print(type(...)) ארבע פעמים.print(type(...)) four times.קלטו סכום חשבון ומספר סועדים. הדפיסו כמה כל אחד משלם, עם בדיוק 2 ספרות אחרי הנקודה.
Read a bill total and a number of diners. Print each person's share with exactly 2 decimals.
סכום: 250 סועדים: 3 83.33
Total: 250 Diners: 3 83.33
f"{share:.2f}"f"{share:.2f}"קלטו כמה עמודים יש בספר וכמה קראתם. הדפיסו את אחוז ההתקדמות כמספר שלם (מעוגל) ואחריו %, וגם כמה ימים נשארו בקצב של 20 עמודים ביום (מעוגל למעלה).
Read a book's total pages and pages read. Print the progress as a whole percent followed by %, and how many days are left at 20 pages a day (rounded up).
עמודים בספר: 412 קראתי: 103 25% ימים שנשארו: 16
Total pages: 412 Pages read: 103 25% Days left: 16
round(read / pages * 100).Percent: round(read / pages * 100).math.ceil((pages - read) / 20).Days: math.ceil((pages - read) / 20).קלטו מספר שניות והדפיסו בפורמט H:MM:SS, למשל 3725 → 1:02:05.
Read a number of seconds and print it as H:MM:SS, e.g. 3725 → 1:02:05.
3725 1:02:05
// ו-% עם 3600 ו-60.// and % with 3600 and 60.{m:02d} מוסיף אפס מוביל.{m:02d} adds a leading zero.קלטו סכום ואחוז ריבית שנתי. הדפיסו את הסכום אחרי 3 שנים של ריבית דריבית, מעוגל ל-2 ספרות. נוסחה: סכום × (1 + ריבית/100) בחזקת 3.
Read an amount and an annual interest percent. Print the amount after 3 years of compound interest, rounded to 2 places. Formula: amount × (1 + rate/100) to the power of 3.
1000 5 1157.63
** לחזקה.** for power.round(x, 2)round(x, 2)נבנה על ידיBuilt by Ariel Yohimovich