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 b5089a2 commit e98733bCopy full SHA for e98733b
1 file changed
implement-cowsay/cow.py
@@ -0,0 +1,32 @@
1
+import argparse
2
+from email import message
3
+import cowsay
4
+
5
+def main():
6
+#Get the list of animals from cowsay library
7
+ animals = sorted(cowsay.char_names)
8
+ parser = argparse.ArgumentParser(
9
+ prog="cowsay",
10
+ description= "Make animal say things"
11
+ )
12
13
+ parser.add_argument(
14
+ "--animal",
15
+ choices=animals,
16
+ default="cow",
17
+ help="The animal to say the message."
18
19
20
+ "message",
21
+ nargs="+",
22
+ help="The message to be said by the animal."
23
24
25
+ args = parser.parse_args()
26
+ # Join message list into a single string
27
+ text = " ".join(args.message)
28
+ # Default animal is "cow" if not specified
29
+ print(cowsay.get_output_string(args.animal, text))
30
31
+if __name__ == "__main__":
32
+ main()
0 commit comments