Skip to content

Commit c2eebab

Browse files
committed
chars->bytes
1 parent 547c168 commit c2eebab

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

06_wc/solution.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,22 @@ def main():
2929

3030
args = get_args()
3131

32-
total_lines, total_chars, total_words = 0, 0, 0
32+
total_lines, total_bytes, total_words = 0, 0, 0
3333
for fh in args.file:
34-
lines, words, chars = 0, 0, 0
34+
num_lines, num_words, num_bytes = 0, 0, 0
3535
for line in fh:
36-
lines += 1
37-
chars += len(line)
38-
words += len(line.split())
36+
num_lines += 1
37+
num_bytes += len(line)
38+
num_words += len(line.split())
3939

40-
total_lines += lines
41-
total_chars += chars
42-
total_words += words
40+
total_lines += num_lines
41+
total_bytes += num_bytes
42+
total_words += num_words
4343

44-
print(f'{lines:8}{words:8}{chars:8} {fh.name}')
44+
print(f'{num_lines:8}{num_words:8}{num_bytes:8} {fh.name}')
4545

4646
if len(args.file) > 1:
47-
print(f'{total_lines:8}{total_words:8}{total_chars:8} total')
47+
print(f'{total_lines:8}{total_words:8}{total_bytes:8} total')
4848

4949

5050
# --------------------------------------------------

0 commit comments

Comments
 (0)