Skip to content

Commit eeb2ced

Browse files
Fix comment formatting in calculate_counts function for clarity
1 parent 3b6d430 commit eeb2ced

File tree

1 file changed

+1
-1
lines changed
  • implement-shell-tools/wc

1 file changed

+1
-1
lines changed

implement-shell-tools/wc/wc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
def calculate_counts(content):
2525
# returns a count object
2626
return {
27-
"lines": content.count('\n') + (1 if content and not content.endswith('\n') else 0),
27+
"lines": content.count('\n') + (1 if content and not content.endswith('\n') else 0), # count lines by '\n'; add 1 if last line has no newline to match real wc command behavior"
2828
"words": len(content.split()),
2929
"bytes": len(content.encode('utf-8')),
3030
}

0 commit comments

Comments
 (0)