Skip to content
Snippets Groups Projects
Commit 9b715a8c authored by aslesha's avatar aslesha
Browse files

lab3 q2

parent d9fe11fe
No related branches found
No related tags found
No related merge requests found
Pipeline #157 canceled
d = {}
fname = input("Enter the name of the file:")
with open(fname, 'r') as f:
line = f.readline()
while line:
line = line.strip()
end = line.find('/', 3)
category = line[3: end]
if category not in d:
d[category] = 0
d[category] = d[category] + 1
line = f.readline()
for (category,cnt) in d.items():
print(category, cnt)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment