Created
September 13, 2021 13:44
-
-
Save codeperfectplus/a731c3f9d4104f177e20a10ba9523d2e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" python gist to create parser """" | |
import argparse | |
def add(x, y): | |
""" it will return the addition of x and y """ | |
return x + y | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--x', type=int, default=1) | |
parser.add_argument('--y', type=int, default=2) | |
args = parser.parse_args() | |
result = add(args.x, args.y) | |
print(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment