Skip to content
Open
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
22 changes: 22 additions & 0 deletions implement-cowsay/cow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import cowsay
import argparse

parser = argparse.ArgumentParser(
prog="cowsay",
description="Simple cowsay clone",
)
parser.add_argument("--animal",choices=cowsay.list_cows(), help="The animal to be saying things.")

Choose a reason for hiding this comment

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

Try running this script without any arguments - what do you expect to happen? does the actual output match this?


parser.add_argument("message",nargs="+", help="Message to be displayed by the cow")
args = parser.parse_args()


msg=" ".join(args.message)


msg = " ".join(args.message)

Choose a reason for hiding this comment

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

Is there a reason you include this line twice?


if args.animal is None:
print(cowsay.cowsay(msg))
else:
print(cowsay.cowsay(msg, cow=args.animal))
Loading