1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00
cowyo/static/text/howmany.py
Zack Scholl da58cd44b8 Python script for determining number of possibilities
Former-commit-id: 3efc82f5ab542fa5905c59311d4d8f877d8c442d [formerly e0ff26e2c2bd6cbba5fca638a7cd4f8b25cbbb07] [formerly d940d376f42774b8da7f0fa6ab0e412148a15b2a [formerly 2b56ce4617]]
Former-commit-id: 09c36203c206bbc77111e5173836a182423e8b4a [formerly 52cb677738e93eea38eb7d9aae08bd83414ce11b]
Former-commit-id: ac981ef357a481db40f9b9f13273ddccf6b1e31c
2016-02-14 08:35:20 -05:00

26 lines
639 B
Python
Executable File

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)