- import random 
-   
- dictionary = [word.strip() for word in open('/usr/share/dict/words')] 
-   
- averages = [] 
-   
- repeatCount = 100 
- wordCount = 1000000 
-   
- for i in xrange(repeatCount): 
-         characters = 0.0 
-         for j in xrange(wordCount): 
-                 characters += len(dictionary[random.randint(0, len(dictionary)-1)]) 
-         averages.append(characters/wordCount) 
-   
- overallAverage = sum(averages) / repeatCount 
-   
- print overallAverage 
 
                Language: python
                Posted by Anonymous at 23 Sep 2013, 03:57:09 UTC