mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Add static and template
Former-commit-id: 46c13d0c36c98e1c4cd7a0548c561dc70c0952ea [formerly 4a56a0bbffd2bb5b437c2c4e7497da0cd42dc306] [formerly c6e51179179dad88c1014b07d13e83f759ad6b6c [formerly 21cd7d092c]]
Former-commit-id: e17744bea8af56671b35709b358bea7d4c9aaff5 [formerly 40b9fe4727f897ee471af9ffce8cd7780f22a612]
Former-commit-id: 0d2322553b3a177f74d4110044e1f801391daaeb
This commit is contained in:
25
static/text/howmany.py
Executable file
25
static/text/howmany.py
Executable 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)
|
||||
Reference in New Issue
Block a user