A relation is a list of pairs. It is a function on a domain when every element of the domain appears exactly once as a first entry. You will test that and read off images.
The idea. Count how often each element of the domain appears as a first entry. Every count must be .
Your tasks.
is_function, return True if every element of domain appears exactly once as a first entry.image, return the second entry of the pair whose first entry is x.functions with the names in relations that are functions on .Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…