Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ee32eb3

Browse files
authored
Add files via upload
1 parent 025abe4 commit ee32eb3

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

02_crowsnest/crowsnest.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Author : Sunil Nahata
4+
Date : 2024-03-21
5+
Purpose: Choose the article
6+
"""
7+
8+
import argparse
9+
10+
11+
# --------------------------------------------------
12+
def get_args():
13+
"""Get command-line arguments"""
14+
15+
parser = argparse.ArgumentParser(
16+
description='Choose the article',
17+
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
18+
19+
parser.add_argument('word',
20+
metavar='word',
21+
help='The thing we see')
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+
article = ""
33+
34+
if word[0].lower() in 'aeiou':
35+
article = "an"
36+
else:
37+
article = "a"
38+
39+
print(f"Ahoy, Captain, {article} {word} off the larboard bow!")
40+
41+
# --------------------------------------------------
42+
if __name__ == '__main__':
43+
main()

0 commit comments

Comments
 (0)