First Non-Prime |2| ~~~~~~~~~~~~~~~~~~~ Write a function named *find_first_non_prime* to find the first non-prime number in the given list. If all the numbers are prime, return ``False``. *Hint:* You can define a helper function to determine whether a number is prime or not then use it in your function. .. container:: sampleio Sample I/O: .. |2| image:: ../../figures/difficulty_four.png :class: difficulty .. code:: default >>> find_first_non_prime([2,3,4,7]) 4 >>> find_first_non_prime([2,3,5,7]) False >>> find_first_non_prime([2,3,51,19]) 51 .. raw:: html .. raw:: html
.. code:: python def is_prime(number): # helper function for i in range(2, number): if number % i == 0: return False return True def find_first_non_prime(items): for item in items: if not is_prime(item): return item return False .. raw:: html