1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

Python script for determining number of possibilities

This commit is contained in:
Zack Scholl
2016-02-14 08:35:20 -05:00
parent 4c6052771d
commit 2b56ce4617
2 changed files with 32 additions and 17 deletions

25
static/text/howmany.py Executable file
View File

@@ -0,0 +1,25 @@
adjectives = {}
with open('adjectives','r') as f:
for line in f:
word = line.strip().lower()
if word[0] not in adjectives:
adjectives[word[0]] = []
adjectives[word[0]].append(word)
print(len(adjectives.keys()))
animals = {}
for aword in open('animals','r').read().split(','):
word = aword.strip().lower()
if word[0] not in animals:
animals[word[0]] = []
animals[word[0]].append(word)
print(len(animals))
i = 0
for key in adjectives.keys():
if key in animals and key in adjectives:
i = i + len(adjectives[key])*len(animals[key])
print(i)