You will write a function for the differences of a list, use it to test for an AP, and sort some lists.
The idea. A list is an AP when all the differences between neighbouring terms are equal. A list of one or two numbers always counts as an AP.
Your tasks.
differences, return the list of differences terms[i + 1] - terms[i].is_ap, return True when all the differences are equal.aps to the names in lists whose list is an AP, in the same order.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…