From 3e6010d14dbb66266837d243b34dc4ae28bb97c8 Mon Sep 17 00:00:00 2001 From: shaghayeghfar <146011477+shaghayeghfar@users.noreply.github.com> Date: Thu, 23 Jul 2026 17:45:45 +0100 Subject: [PATCH 1/2] implement cowsay in python --- 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..39549a544 --- /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 = cowsay.list_cows() + +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 From 2c512be1d6c8374ac8c61180e7477cd87ee7cba6 Mon Sep 17 00:00:00 2001 From: shaghayeghfar <146011477+shaghayeghfar@users.noreply.github.com> Date: Fri, 24 Jul 2026 09:58:36 +0100 Subject: [PATCH 2/2] eror was fixed --- implement-cowsay/cow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implement-cowsay/cow.py b/implement-cowsay/cow.py index 39549a544..17c60e7ee 100644 --- a/implement-cowsay/cow.py +++ b/implement-cowsay/cow.py @@ -5,7 +5,7 @@ parser = argparse.ArgumentParser(description="Make animals say things") # Get supported animals from cowsay library -animals = cowsay.list_cows() +animals = list(cowsay.char_funcs.keys()) parser.add_argument( "message",