Solve 7.8 LAB
This commit is contained in:
parent
030dd0b611
commit
8e662c58bf
|
@ -0,0 +1 @@
|
||||||
|
hello,cat,man,hey,dog,boy,Hello,man,cat,woman,dog,Cat,hey,boy
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
import csv
|
||||||
|
|
||||||
|
with open(input(), newline='') as f:
|
||||||
|
reader = csv.reader(f)
|
||||||
|
data = list(reader)[0]
|
||||||
|
|
||||||
|
result = {}
|
||||||
|
|
||||||
|
for entry in data:
|
||||||
|
try:
|
||||||
|
result[entry]
|
||||||
|
|
||||||
|
result[entry] = result[entry] + 1
|
||||||
|
except KeyError:
|
||||||
|
result[entry] = 1
|
||||||
|
|
||||||
|
for key in result:
|
||||||
|
print('{0} {1}'.format(key, result[key]))
|
Loading…
Reference in New Issue