On 07/09/2010 21:06, Paul Rubin wrote:
Baba<raoul...@gmail.com>  writes:
word= 'even'
dict2 = {'i': 1, 'n': 1, 'e': 1, 'l': 2, 'v': 2}

i want to know if word is entirely composed of letters in dict2

set(word)<= set(dict2.keys())

Do the numbers in dict2 represent the maximum number of times that the
letter can be used?

If yes, then build a similar dict for the word with the number of times
that each letter occurs in the word and then check for every pair in
the dict whether the key (ie, letter) occurs in dict2 and that the
value (number of occurrences) isn't too many.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to