-
-
Notifications
You must be signed in to change notification settings - Fork 88
London|25-SDC-NOV| FATMA DEGIRMENCI | Sprint 4|Implement cowsay #290
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .venv/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import argparse | ||
| import cowsay | ||
|
|
||
|
|
||
| parser = argparse.ArgumentParser(description="implement Cowsay command") | ||
| parser.add_argument("text", help="Text to be displayed") | ||
| parser.add_argument("--animal", help="Animal to say the text", default="cow") | ||
| args = parser.parse_args() | ||
|
|
||
| animals = cowsay.char_names | ||
| animal = args.animal.lower() | ||
| if animal not in animals: | ||
| print(f"Invalid animal. Supported animals are: {', '.join(animals)}") | ||
| exit(1) | ||
| cowsay.char_funcs[animal](args.text) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if I give my arguments as plain text, without quotes?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the feedback |
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you get the help to show the list of possible animals?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your feedback. I’ve added a list of all cowsay animals to the help output so can see the available options.