Even and odd X25424


Statement
 

pdf   zip

You have to program the function below.

  • Write a function @even_odd(f)@ that given a list ff of integer numbers, returns two lists. The first one is formed by the even numbers in ff. At the second one there are the odd numbers in ff. The order of appearance of the numbers in each of the two resulting lists must preserve the original order.

Scoring

The function counts 100 points.

Sample session

Sample session
>>> even_odd([1, 5, 2, 5, 4, 3, 0])
([2, 4, 0], [1, 5, 5, 3])
>>> even_odd([1, 3, 5])
([], [1, 3, 5])
>>> even_odd([0, 4])
([0, 4], [])
Information
Author
ProAl
Language
English
Official solutions
Python
User solutions
Python