From 900e052383d804cf827f1645ca5da696b20aa28d Mon Sep 17 00:00:00 2001 From: Onur Atas <114289826+onurat@users.noreply.github.com> Date: Fri, 29 May 2026 12:45:01 +0100 Subject: [PATCH] Implement cowsay in Python --- implement-cowsay/cow.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 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..073fe5846 --- /dev/null +++ b/implement-cowsay/cow.py @@ -0,0 +1,28 @@ +import argparse +import cowsay + +parser = argparse.ArgumentParser( + prog="cowsay", + description="Make animals say things" +) + +parser.add_argument( + "--animal", + choices=cowsay.char_names, + default="cow", + help="The animal to be saying things." +) + +parser.add_argument( + "message", + nargs="+", + help="The message to say." +) + +args = parser.parse_args() + +message = " ".join(args.message) + +animal = getattr(cowsay, args.animal) + +animal(message)