spacepaste

  1.  
  2. def calculate(firstOperand, secondOperand, operand):
  3. if operand == '+':
  4. print(int(firstOperand) + int(secondOperand))
  5. elif operand == '-':
  6. print(int(firstOperand) - int(secondOperand))
  7. elif operand == '*':
  8. print(int(firstOperand) * int(secondOperand))
  9. elif operand == '/':
  10. print(int(firstOperand) / int(secondOperand))
  11. else:
  12. print("Invalid input. Try again\n")
  13. menu()
  14. def menu():
  15. print("\nWelcome to the calculator program")
  16. print("Please enter your operands and operator")
  17. firstOperand = raw_input("\nFirst operand:")
  18. secondOperand = raw_input("\nSecond operand:")
  19. operand = raw_input("\n Operand:")
  20. return (firstOperand, secondOperand, operand)
  21. (firstOperand, secondOperand, operand) = menu()
  22. calculate(firstOperand, secondOperand, operand)
  23.