forked from prog4biol/pfb2024
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shirts.py
36 lines (31 loc) · 871 Bytes
/
shirts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
"""
mens large heather purple
mens small heather seafoam
womens medium Heather Purple
womens medium berry
mens medium heather coral silk
womens Small Kiwi
mens large Graphite Heather
mens large sport grey
"""
shirts = {}
with open("shirts.txt","r") as file_object:
for line in file_object:
line = line.rstrip()
[style, size, color] = line.split("\t")
style = style.lower()
size = size.lower()
color = color.lower()
if style not in shirts:
shirts[style] = {}
if size not in shirts[style]:
shirts[style][size] = {}
if color not in shirts[style][size]:
shirts[style][size][color] = 0
shirts[style][size][color] += 1
for style in shirts:
for size in shirts[style]:
for color in shirts[style][size]:
count = shirts[style][size][color]
print(style,size,color,count)