From 9914ae491731126a41d469a40f047fa3db9b1387 Mon Sep 17 00:00:00 2001 From: Droid-An Date: Sun, 3 Aug 2025 13:05:23 +0100 Subject: [PATCH 1/2] done cow.py --- implement-cowsay/cow.py | 19 +++++++++++++++++++ implement-cowsay/requirements.txt | 1 + 2 files changed, 20 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..cbcebd9f --- /dev/null +++ b/implement-cowsay/cow.py @@ -0,0 +1,19 @@ +import cowsay +import sys +import argparse +import os + +list_of_choices = cowsay.char_names + + +parser = argparse.ArgumentParser( + prog="cowsay", + description="Make animals say things", +) + +parser.add_argument("--animal", nargs="?",default="cow", help="The animal to be saying things.", choices=list_of_choices) +parser.add_argument("message", nargs="*", default="", help="message to say") + +args = parser.parse_args() + +print(cowsay.get_output_string(str(args.animal)," ".join(args.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..cc557103 --- /dev/null +++ b/implement-cowsay/requirements.txt @@ -0,0 +1 @@ +cowsay \ No newline at end of file From 49089e35c958fc3e40293df2f6ebfa7c02ac0090 Mon Sep 17 00:00:00 2001 From: Droid-An Date: Wed, 20 Aug 2025 18:08:59 +0100 Subject: [PATCH 2/2] formatted code and removed unused libraries --- implement-cowsay/cow.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/implement-cowsay/cow.py b/implement-cowsay/cow.py index cbcebd9f..ff05fd97 100644 --- a/implement-cowsay/cow.py +++ b/implement-cowsay/cow.py @@ -1,7 +1,5 @@ import cowsay -import sys import argparse -import os list_of_choices = cowsay.char_names @@ -11,9 +9,15 @@ description="Make animals say things", ) -parser.add_argument("--animal", nargs="?",default="cow", help="The animal to be saying things.", choices=list_of_choices) +parser.add_argument( + "--animal", + nargs="?", + default="cow", + help="The animal to be saying things.", + choices=list_of_choices, +) parser.add_argument("message", nargs="*", default="", help="message to say") args = parser.parse_args() -print(cowsay.get_output_string(str(args.animal)," ".join(args.message))) \ No newline at end of file +print(cowsay.get_output_string(str(args.animal), " ".join(args.message)))