Last active
April 21, 2019 17:02
-
-
Save amirzenoozi/3b404a4ca004e19705f7e76371f898a8 to your computer and use it in GitHub Desktop.
This file contains 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
import argparse | |
parser = argparse.ArgumentParser(description='Add some integers.') | |
parser.add_argument('integers', metavar='N', type=int, nargs='+', | |
help='interger list') | |
parser.add_argument('--sum', action='store_const', | |
const=sum, default=max, | |
help='sum the integers (default: find the max)') | |
args = parser.parse_args() | |
print(args.sum(args.integers)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment