En Thu, 25 Oct 2007 00:40:12 -0300, sandipm [EMAIL PROTECTED]
escribi�:
thanks..I am using python 2.4.4. so i couldnt find all either as
inbuilt module
or by doing from itertools import *, all is not available.
I think I need to move to 2.5 then
It's easy to write in pure Python:
On Oct 24, 2:28 am, Paul Hankin [EMAIL PROTECTED] wrote:
On Oct 23, 9:21 am, [EMAIL PROTECTED] wrote:
This one uses a dictionary to store prime values of each letter in the
alphabet and for each line multiple the results of the characters
(which is unique for each anagram) and add them to
hi,
Is all inbuilt function in python? what it does?
from itertools import ifilter, count
def anagram_finder():
primes = ifilter(lambda p: all(p % k for k in xrange(2, p)), count(2))
primeAlpha = dict(zip(string.lowercase, primes))
...
On Oct 24, 5:03 pm, sandipm [EMAIL PROTECTED] wrote:
Is all inbuilt function in python? what it does?
help(all)
Help on built-in function all in module __builtin__:
all(...)
all(iterable) - bool
Return True if bool(x) is True for all values x in the iterable.
--
Paul Hankin
--
Is all inbuilt function in python? what it does?
help(all)
Help on built-in function all in module __builtin__:
all(...)
all(iterable) - bool
Return True if bool(x) is True for all values x in the iterable.
It may be helpful to know that any() and all() were added in
Python
thanks..I am using python 2.4.4. so i couldnt find all either as
inbuilt module
or by doing from itertools import *, all is not available.
I think I need to move to 2.5 then
but what are the pros/cons of moving to 2.5? as we are using 2.4.4 on
production server which is quite stable.
any
of C modules and such like), just python and
good computer science techniques.
For the wordlist go to this link a href=http://codekata.pragprog.com/
2007/01/kata_six_anagra.htmlKata Anagrams/a
Anyway here are my two examples.
This one uses a dictionary to store prime values of each letter
techniques people have (without
resorting to overusage of C modules and such like), just python and
good computer science techniques.
For the wordlist go to this link a href=http://codekata.pragprog.com/
2007/01/kata_six_anagra.htmlKata Anagrams/a
Anyway here are my two examples.
This one uses
/kata_six_anagra.htmlKata Anagrams/a
Anyway here are my two examples.
This one uses a dictionary to store prime values of each letter in the
alphabet and for each line multiple the results of the characters
(which is unique for each anagram) and add them to a dictionary for
printing latter.
pre
def
On Oct 23, 9:21 am, [EMAIL PROTECTED] wrote:
This one uses a dictionary to store prime values of each letter in the
alphabet and for each line multiple the results of the characters
(which is unique for each anagram) and add them to a dictionary for
printing latter.
def anagram_finder():
10 matches
Mail list logo