Python program to make simple calculator In this example you will learn to create a simple calculator that can add,subtract,multiply or divide depending upon the input from the user. Example: simple calculator by using functions. def add ( num1 , num2 ): return num1+num2 def subtract ( num1 , num2 ): return num1-num2 def multiply ( num1 , num2 ): return num1*num2 def divide ( num1 , num2 ): return num1/num2 print ( "please enter your choice :\n" \ "2.subtract\n" \ "3.multiply\n" \ "4.divide\n" ) ch=int( input ( "please enter your choice :" )) num1 = int( input ( "Enter the first number:" )) if ch== 1 : print (num1+num2) elif ch== 2 : print (num1-num2) elif ch== 3 : print (num1*num2) elif ch== 4 : print (num1 /num2) else : print ( "invalid choice" ) num2 = int( input ( "Enter the second number:" )) "1.add\n