Skip to content

London | Ameneh Keshavarz | Module-Tools | WEEK4 #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
venv/
33 changes: 33 additions & 0 deletions implement-cowsay/cow.py

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a short comment to explain your logic

Copy link
Author

@Ameneh-Keshavarz Ameneh-Keshavarz Jun 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, This program us you choose an animal (like a cow, dragon, etc.) to "say" a message using ASCII art. It uses command-line arguments to get the animal type and the message. The message is combined into a single string, and the correct cowsay function is called to display it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I also added commnets in the code

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This program lets you choose an animal (like a cow, dragon, etc.) to "say" a message using ASCII art.
# It uses command-line arguments to get the animal type and the message.
# The message is combined into a single string, and the correct cowsay function is called to display it.

import argparse
import cowsay

def parse_arguments():
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."
)
return parser.parse_args()

def main():
args = parse_arguments()
message = " ".join(args.message)
say_func = getattr(cowsay, args.animal)
say_func(message)

if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions implement-cowsay/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cowsay==6.1