We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c336074 commit 7e2e5eeCopy full SHA for 7e2e5ee
scripts/words_count.py
@@ -8,16 +8,16 @@
8
9
10
def print_dictionary(dic, file_name):
11
- print("Word\tNumber of occurrences in {0}",file_name)
+ print(f"\t\tWord\t\tNumber of occurrences")
12
+ print(f"\t\t----\t\t---------------------")
13
for key in dic.keys():
- print(f"{key}-{dic[key]}")
14
+ print('{:>20} {:>20}'.format(key, dic[key]))
15
16
def main():
17
file_name = input("Please insert file name to work with: ")
18
alpha_statistic = {}
19
with open(file_name,'r') as f:
20
lines = f.readlines()
- print(lines)
21
for line in lines:
22
for word in line.split():
23
if word.rstrip() in alpha_statistic.keys():
0 commit comments