lesson
First even number
objective: debugging exercise · count, filter & search · medium
Task type: fix broken code
first_even(nums) should return the FIRST even number in the list, or None if there isn't one. Right now it returns the wrong one.
fix this code so it matches
first_even([1, 3, 4, 5, 6]) is 4. first_even([2, 4, 6]) is 2. first_even([1, 3, 5]) is None. first_even([]) is None.
- ○Passes the visible tests
- ○Passes the hidden tests (edge cases)
Go deeper
Lesson resources
first_even.pyattempt 0
1
2
3
4
5
6
7