Skip to content

Commit e82a316

Browse files
committed
Create hello.py
1 parent 8b49d04 commit e82a316

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

01_hello/hello.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env python3
2+
'''
3+
Author: Gary Netherton w/guidance from KYClark
4+
Purpose: Say hello
5+
'''
6+
7+
import argparse
8+
9+
10+
def get_args():
11+
'''Get command line arguments'''
12+
parser = argparse.ArgumentParser(description = 'Say hello')
13+
parser.add_argument('-n', '--name',
14+
metavar ='name',
15+
default = "World",
16+
help= 'Name to greet')
17+
return parser.parse_args()
18+
19+
def main():
20+
'''Main function'''
21+
22+
args = get_args()
23+
print("Hello, " + args.name + "!")
24+
25+
# ----------------------------------------------------------
26+
if __name__ == '__main__':
27+
main()

0 commit comments

Comments
 (0)