import optparse def calculate(): if options.operand == '+': print(int(options.first) + int(options.second)) elif options.operand == '-': print(int(options.first) - int(options.second)) elif options.operand == '*': print(int(options.first) * int(options.second)) elif options.operand == '/': print(int(options.first) / int(options.second)) else: print("Invalid input. Try again\n") def menu(): print("\nWelcome to the calculator program") print("Please enter your operands and operator") #firstOperand = raw_input("\nFirst operand:") #secondOperand = raw_input("\nSecond operand:") #operand = raw_input("\n Operand:") parser = optparse.OptionParser() parser.add_option("-f", "--first", dest="first", help="First operand") parser.add_option("-s", "--second", dest="second", help="Seoncd operand") parser.add_option("-o", "--operand", dest="operand", help="Operand") (options, arguments) = parser.parse_args() calculate()