Skip to content · ⁨דלג לתוכן⁩

Keep the evens · ⁨שמור את הזוגיים⁩

English

Keep the evens

Filter a list: keep some items and leave the rest out.

Start with an empty list, loop over nums, and .append() each number that passes the test n % 2 == 0. Return the new list after the loop has finished.

עברית

שמירת זוגיות

סינון רשימה: שמור חלק מהפריטים ושאר אותם בחוץ.

התחל עם רשימה ריקה, לולאת על nums, והוסף (.append()) כל מספר שעובר את הבדיקה n % 2 == 0. החזר את הרשימה החדשה לאחר סיום הלולאה.

Log in or create account · ⁨היכנס או צור חשבון⁩

IGCSE, A-Level & AP