Created
December 17, 2021 04:10
-
-
Save loudambiance/5352d07b12bf36bf30d8bd3e8144d23d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test = False | |
file = 'data/task8test.txt' if test else 'data/task8.txt' | |
data = [] | |
with open(file) as f: | |
lines = f.read().splitlines() | |
for line in lines: | |
data.extend(line.split(' | ')[1].split(' ')) | |
count = sum(list(map(lambda x: 1 if len(x) == 2 or len(x) == 3 or len(x) == 4 or len (x)==7 else 0, data))) | |
print(count) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment