File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+ """
3
+ Author : NowHappy <[email protected] >
4
+ Date : 2021-09-28
5
+ Purpose: Rock the Casbah
6
+ """
7
+
8
+ import argparse
9
+
10
+
11
+ # --------------------------------------------------
12
+ def get_args ():
13
+ """Get command-line arguments"""
14
+
15
+ parser = argparse .ArgumentParser (
16
+ description = "Crow's Nest -- choose the correct article" ,
17
+ formatter_class = argparse .ArgumentDefaultsHelpFormatter )
18
+
19
+ parser .add_argument ('word' ,
20
+ metavar = 'word' ,
21
+ help = 'A word' )
22
+
23
+ return parser .parse_args ()
24
+
25
+
26
+ # --------------------------------------------------
27
+ def main ():
28
+ """Make a jazz noise here"""
29
+
30
+ args = get_args ()
31
+ word = args .word
32
+ char = word [0 ].lower ()
33
+ article = 'an' if char in 'aeiou' else 'a'
34
+ print (f'Ahoy, Captain, { article } { word } off the larboard bow!' )
35
+
36
+
37
+ # --------------------------------------------------
38
+ if __name__ == '__main__' :
39
+ main ()
You can’t perform that action at this time.
0 commit comments