We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 407b010 commit 475c940Copy full SHA for 475c940
implement-cowsay/.gitignore
@@ -0,0 +1 @@
1
+.venv/
implement-cowsay/cow.py
@@ -0,0 +1,17 @@
+import argparse
2
+import cowsay
3
+
4
5
+parser = argparse.ArgumentParser(description="implement Cowsay command")
6
+parser.add_argument("text", help="Text to be displayed")
7
+parser.add_argument("--animal", help="Animal to say the text", default="cow")
8
+args = parser.parse_args()
9
10
+animals = cowsay.char_names
11
+animal = args.animal.lower()
12
+if animal not in animals:
13
+ print(f"Invalid animal. Supported animals are: {', '.join(animals)}")
14
+ exit(1)
15
+cowsay.char_funcs[animal](args.text)
16
17
0 commit comments