From 8b93bc4d4070b29bbeb96412025ee6f0c855e129 Mon Sep 17 00:00:00 2001 From: Rihanna P <114884466+RihannaP@users.noreply.github.com> Date: Thu, 23 Oct 2025 00:13:36 +0100 Subject: [PATCH 1/2] Implement cowsay in py --- implement-cowsay/cow.py | 20 ++++++++++++++++++++ implement-cowsay/requirements.txt | 1 + 2 files changed, 21 insertions(+) create mode 100644 implement-cowsay/cow.py create mode 100644 implement-cowsay/requirements.txt diff --git a/implement-cowsay/cow.py b/implement-cowsay/cow.py new file mode 100644 index 00000000..19f49f06 --- /dev/null +++ b/implement-cowsay/cow.py @@ -0,0 +1,20 @@ +import cowsay +import argparse + +# cowsay.cow(" ".join(sys.argv[1:])) + + +parser = argparse.ArgumentParser(prog="cow.py", description="Make animals say things") +parser.add_argument("--animal", choices=cowsay.char_names, help="The animal is saying somethings", default="cow") +parser.add_argument("message", nargs="+", help="The message to say") + +args = parser.parse_args() + +char_name = args.animal +message = " ".join(args.message) + +# cowsay_func = getattr(cowsay, char_name) +# cowsay_func(message) + + +print(cowsay.get_output_string(args.animal, message)) \ No newline at end of file diff --git a/implement-cowsay/requirements.txt b/implement-cowsay/requirements.txt new file mode 100644 index 00000000..c6b9ffd0 --- /dev/null +++ b/implement-cowsay/requirements.txt @@ -0,0 +1 @@ +cowsay From deb4b89031a36be4654958ce19d383a74dabe731 Mon Sep 17 00:00:00 2001 From: Rihanna P <114884466+RihannaP@users.noreply.github.com> Date: Thu, 23 Oct 2025 00:15:52 +0100 Subject: [PATCH 2/2] cleaning --- implement-cowsay/cow.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/implement-cowsay/cow.py b/implement-cowsay/cow.py index 19f49f06..7bce865c 100644 --- a/implement-cowsay/cow.py +++ b/implement-cowsay/cow.py @@ -1,7 +1,6 @@ import cowsay import argparse -# cowsay.cow(" ".join(sys.argv[1:])) parser = argparse.ArgumentParser(prog="cow.py", description="Make animals say things") @@ -13,8 +12,5 @@ char_name = args.animal message = " ".join(args.message) -# cowsay_func = getattr(cowsay, char_name) -# cowsay_func(message) - print(cowsay.get_output_string(args.animal, message)) \ No newline at end of file