Abhiram R wrote: > Haha. Nice. Although with your length of string and the range you're > picking from,the chances of you getting a palindrome are (1/24!) :D
Are you sure? >>> candidates = list(itertools.product(string.ascii_lowercase, repeat=4)) >>> len(candidates)/len([c for c in candidates if c == c[::-1]]) 676.0 That looks like one in 26**(length//2) -- https://mail.python.org/mailman/listinfo/python-list