Skip to content

Instantly share code, notes, and snippets.

@codeperfectplus
Created September 13, 2021 13:44
Show Gist options
  • Save codeperfectplus/a731c3f9d4104f177e20a10ba9523d2e to your computer and use it in GitHub Desktop.
Save codeperfectplus/a731c3f9d4104f177e20a10ba9523d2e to your computer and use it in GitHub Desktop.
""" 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