Which numbers appear multiple times in a given list?

Assignment

  1. Write a function double that takes a list of numbers as an argument, and prints the element of the list that occurs twice. The function must print the value None if no number occurs more than once in the list. There is one number at the most that appears twice.

  2. Write a function doubles that takes a list of numbers as an argument, and prints two collections. The first collection contains all elements that only occur once in the list and the second collection contains all elements that occur more than once in the list.

Example

>>> double([1, 2, 3, 4, 2])
2
>>> double([1, 2, 3, 4])
>>> double([1, 2, 3, 4, 5, 6, 100, -234, 15, 0, -20000, 15])
15

>>> doubles([1, 2, 3, 4, 2])
({1, 3, 4}, {2})
>>> doubles([2, 8, 8, 6, 10, -20, -4, -2, -4])
({2, 6, 10, -20, -2}, {8, -4})
>>> doubles([1, 3, 5, 7, 2, 4, 6])
({1, 2, 3, 4, 5, 6, 7}, set())