From 58619f1d8a80f1f6eac29550977cb967ef5d16d0 Mon Sep 17 00:00:00 2001 From: shaghayeghfar <146011477+shaghayeghfar@users.noreply.github.com> Date: Fri, 24 Jul 2026 10:10:21 +0100 Subject: [PATCH] implement cowsay task --- implement-cowsay/cow.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 implement-cowsay/cow.py diff --git a/implement-cowsay/cow.py b/implement-cowsay/cow.py new file mode 100644 index 000000000..17c60e7ee --- /dev/null +++ b/implement-cowsay/cow.py @@ -0,0 +1,30 @@ +import argparse +import cowsay + + +parser = argparse.ArgumentParser(description="Make animals say things") + +# Get supported animals from cowsay library +animals = list(cowsay.char_funcs.keys()) + +parser.add_argument( + "message", + nargs="+", + help="The message to say." +) + +parser.add_argument( + "--animal", + choices=animals, + default="cow", + help="The animal to be saying things." +) + +args = parser.parse_args() + +message = " ".join(args.message) + +# Call the selected animal function from cowsay +animal = getattr(cowsay, args.animal) + +animal(message) \ No newline at end of file