#!/usr/bin/env python3 import argparse # create parser parser = argparse.ArgumentParser( description='add or substract command line arguments', epilog = 'please report comments/bugs to arlotto@univ-tln.fr') #position 1 parser.add_argument('a', type = float) #position 2 parser.add_argument('b', type = float) # add option parser.add_argument('-s','--substract', action='store_true', help='substract b from a') args = parser.parse_args() a = args.a b = args.b if args.substract == False : res = a + b else : res = a - b print(res)