From 45857a8028a460cf1c06d644f6d2b1715db756a5 Mon Sep 17 00:00:00 2001 From: mirabellemorah Date: Mon, 10 Aug 2026 04:13:49 +0100 Subject: [PATCH] implementing cosway --- implement-cowsay/.gitignore | 1 + implement-cowsay/cow.py | 21 +++++++++++++++++++++ implement-cowsay/requirements.txt | 1 + 3 files changed, 23 insertions(+) create mode 100644 implement-cowsay/.gitignore create mode 100644 implement-cowsay/cow.py create mode 100644 implement-cowsay/requirements.txt diff --git a/implement-cowsay/.gitignore b/implement-cowsay/.gitignore new file mode 100644 index 000000000..1d17dae13 --- /dev/null +++ b/implement-cowsay/.gitignore @@ -0,0 +1 @@ +.venv diff --git a/implement-cowsay/cow.py b/implement-cowsay/cow.py new file mode 100644 index 000000000..62a67afaf --- /dev/null +++ b/implement-cowsay/cow.py @@ -0,0 +1,21 @@ +import argparse +import cowsay + +parser = argparse.ArgumentParser( + prog="cowsay", + description="implementing cowsay and other animals", +) + +parser.add_argument("speak", nargs="+", help="what to speak about",) +parser.add_argument("--animal", choices=cowsay.char_names, default="cow", help="The animal to be saying things.",) + +args = parser.parse_args() + +speak = " ".join(args.speak) + +output = cowsay.get_output_string(args.animal, speak) +print(output) + +#I can use the below as another approach to print directly and almost like saying cowsay.turtle +# animal_function = cowsay.char_funcs[args.animal] +# animal_function(speak) \ No newline at end of file diff --git a/implement-cowsay/requirements.txt b/implement-cowsay/requirements.txt new file mode 100644 index 000000000..c6b9ffd0e --- /dev/null +++ b/implement-cowsay/requirements.txt @@ -0,0 +1 @@ +cowsay