Simple Calculator using Python Posted by Samath Last Updated: January 09, 2017 1725

This is a simple calculator using the python programming language. The program provide a menu to the user to choose the type of operation they want to perform, after which the program will ask for 2 number to calculate. The program will run infinitely until the user quit the program.

```isRunning = True

while isRunning:
print("2 = Subtraction")
print("3 = Multiplication")
print("4 = Division")
print("5 = Exit program")
cmd = int(input("Enter number : "))
if cmd == 1:
first = int(input("Enter first number :"))
second = int(input("Enter second number :"))
result = first + second
print(str(first) +'+' +str(second) +'=' + str(result))
elif cmd == 2:
print("Subtraction")
first = int(input("Enter first number :"))
second = int(input("Enter second number :"))
result = first - second
print(str(first) +"-" +str(second) +"=" + str(result))
elif cmd == 3:
print("Multiplication")
first = int(input("Enter first number :"))
second = int(input("Enter second number :"))
result = first * second
print(str(first) + "*" +str(second) +"=" + str(result))
elif cmd == 4:
print("Division")
first = int(input("Enter first number :"))
second = int(input("Enter second number :"))
result = first / second
print(str(first) +"/" +str(second) +"=" + str(result))
elif cmd == 5:
print("Quit!")
isRunning = False```