Skip to content

Commit 7e2e5ee

Browse files
committed
formatig
1 parent c336074 commit 7e2e5ee

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/words_count.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88

99

1010
def print_dictionary(dic, file_name):
11-
print("Word\tNumber of occurrences in {0}",file_name)
11+
print(f"\t\tWord\t\tNumber of occurrences")
12+
print(f"\t\t----\t\t---------------------")
1213
for key in dic.keys():
13-
print(f"{key}-{dic[key]}")
14+
print('{:>20} {:>20}'.format(key, dic[key]))
1415

1516
def main():
1617
file_name = input("Please insert file name to work with: ")
1718
alpha_statistic = {}
1819
with open(file_name,'r') as f:
1920
lines = f.readlines()
20-
print(lines)
2121
for line in lines:
2222
for word in line.split():
2323
if word.rstrip() in alpha_statistic.keys():

0 commit comments

Comments
 (0)