On Tue, 7 Sep 2010 12:46:36 -0700 (PDT), Baba
wrote:
>level: beginner
>
>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
>
>my approach:
>step 1 : convert word to dictionary(dict1)
>
>step2:
>for k in dict1.keys():
On 07/09/2010 22:36, Baba wrote:
On 7 sep, 22:37, MRAB wrote:
On 07/09/2010 21:06, Paul Rubin wrote:
Babawrites:
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 numb
On 09/07/2010 01:26 PM, Baba wrote:
On 7 sep, 22:08, Gary Herron wrote:
On 09/07/2010 12:46 PM, Baba wrote:
word= 'even'
dict2 = {'i': 1, 'n': 1, 'e': 1, 'l': 2, 'v': 2}
Just go through each letter of word checking for its existence in
dict2. Return False if one misses, an
Baba writes:
> for k in word.keys():
> if k not in hand:
> return False
> elif k in hand:
> if word[k] > hand[k]:
> return False
> return True
Untested:
all(word[k] <= hand.get(k,0) for k in word)
--
http://
On 7 sep, 22:37, MRAB wrote:
> On 07/09/2010 21:06, Paul Rubin wrote:
>
> > Baba 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 r
Baba wrote:
> On 7 sep, 22:08, Gary Herron wrote:
>> On 09/07/2010 12:46 PM, Baba wrote:
>>
>> > word= 'even'
>> > dict2 = {'i': 1, 'n': 1, 'e': 1, 'l': 2, 'v': 2}
>>
>> Just go through each letter of word checking for its existence in
>> dict2. Return False if one misses, and True if you get th
On Wed, Sep 8, 2010 at 1:56 AM, Baba wrote:
> On 7 sep, 22:08, Gary Herron wrote:
> > On 09/07/2010 12:46 PM, Baba wrote:
> >
> > > word= 'even'
> > > dict2 = {'i': 1, 'n': 1, 'e': 1, 'l': 2, 'v': 2}
> >
> > Just go through each letter of word checking for its existence in
> > dict2. Return Fal
On 07/09/2010 21:06, Paul Rubin wrote:
Baba 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
On 7 sep, 22:08, Gary Herron wrote:
> On 09/07/2010 12:46 PM, Baba wrote:
>
> > word= 'even'
> > dict2 = {'i': 1, 'n': 1, 'e': 1, 'l': 2, 'v': 2}
>
> Just go through each letter of word checking for its existence in
> dict2. Return False if one misses, and True if you get through the
> whole word
On 09/07/2010 12:46 PM, Baba wrote:
word= 'even'
dict2 = {'i': 1, 'n': 1, 'e': 1, 'l': 2, 'v': 2}
Just go through each letter of word checking for its existence in
dict2. Return False if one misses, and True if you get through the
whole word:
def ...():
for c in word:
if c not in
Baba 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())
--
http://mail.python.org/mailman/listinfo/python-list
level: beginner
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
my approach:
step 1 : convert word to dictionary(dict1)
step2:
for k in dict1.keys():
if k in dict2:
if dict1[k] != dict2[k]:
12 matches
Mail list logo