Skip to content

Commit 610bb32

Browse files
committed
completing cowsay exercies
1 parent 3f26722 commit 610bb32

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

implement-cowsay/cow.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env python3
2+
3+
import argparse
4+
import cowsay
5+
6+
7+
def main():
8+
parser = argparse.ArgumentParser(description="Make animals say things")
9+
10+
parser.add_argument(
11+
"--animal",
12+
choices=cowsay.char_names,
13+
default="cow",
14+
help="The animal to be saying things.",
15+
)
16+
17+
parser.add_argument(
18+
"message",
19+
nargs="+",
20+
help="The message to say.",
21+
)
22+
23+
args = parser.parse_args()
24+
25+
text = " ".join(args.message)
26+
print(cowsay.get_output_string(args.animal, text))
27+
28+
29+
if __name__ == "__main__":
30+
main()

0 commit comments

Comments
 (0)