In section 9.2 of the textbook, a program is described that can determine a frequency table from the words in a text. The goal of this exercise is to write the function that works on a dictionary as made by that program, i.e. you may assume that the dictionary has strings as keys and integers as values. The intention is to write a function that prints the amount of long and short words in a text (for a given definition of short and long).

Assignment

Write a function longShort that takes a whole number as an argument and prints a tuple of integers. The first number in the result is the sum of the values of the items with a key that has a length larger than or equal to the given integer. The second number is the sum of the other values.

Example

>>> table = {'hello': 1, 'world':1}
>>> longShort(table, 5)
(2, 0)
>>> longShort(table, 6)
(1, 1)
>>> longShort(table, 10)
(0, 2)