Skip to content

Commit 687e4d8

Browse files
committed
Fix printing 'None' when cowsay animal functions print directly instead of returning output
1 parent 96c0d12 commit 687e4d8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

implement-cowsay/cow.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ def main():
4141
try:
4242
animal_func = getattr(cowsay, args.animal)
4343
output = animal_func(message)
44-
print(output)
44+
if output is not None:
45+
print(output)
4546
except AttributeError:
4647
print(f"Error: '{args.animal}' is not a valid animal.", file=sys.stderr)
4748
sys.exit(1)

0 commit comments

Comments
 (0)