Skip to main content
← CoursesPython FoundationsModule 1 · Fundamentals of syntaxEven/oddwrite10 / 170
💬 Discuss🧪 Playground+75 XP
Task
📝 **Task:** Write a function `is_even(n)` that returns `True` if the number is even, `False` otherwise. 📋 **Steps:** 1. Define `def is_even(n):` 2. Use the modulo operator: `n % 2 == 0` 3. Return that comparison via `return` 4. Call the function twice: `is_even(4)` and `is_even(7)` 💡 **Similar example (divisibility by 5):** ```python def divisible_by_5(n): return n % 5 == 0 print(divisible_by_5(15)) # True print(divisible_by_5(11)) # False ``` ⚠️ **Hint:** `n % 2` is 0 for even, 1 for odd. Compare with 0. 🎯 **Expected output:** ``` True False ```

Keep going

✏️ Write your code here
🐍
Loading Python...
First visit only — ~5-10s. Stays cached afterward.
📊 Result
Press Run to see result...
📣 Help someone learn PythonShare this lesson with a friend — the first 15 are free, no signup.Tweet

💬 Discussion

Be the first to ask a question or share a tip.
Sign in to join the discussion. Reading is free.
Loading discussion…