From e82a316f4d068b8608bd5fd5977f0321fb50f0f3 Mon Sep 17 00:00:00 2001 From: Gary Netherton Date: Sun, 4 Jul 2021 12:19:38 -0700 Subject: [PATCH] Create hello.py --- 01_hello/hello.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 01_hello/hello.py diff --git a/01_hello/hello.py b/01_hello/hello.py new file mode 100755 index 000000000..e992628fe --- /dev/null +++ b/01_hello/hello.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 +''' +Author: Gary Netherton w/guidance from KYClark +Purpose: Say hello +''' + +import argparse + + +def get_args(): + '''Get command line arguments''' + parser = argparse.ArgumentParser(description = 'Say hello') + parser.add_argument('-n', '--name', + metavar ='name', + default = "World", + help= 'Name to greet') + return parser.parse_args() + +def main(): + '''Main function''' + + args = get_args() + print("Hello, " + args.name + "!") + +# ---------------------------------------------------------- +if __name__ == '__main__': + main()