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