Skip to main content

How to make calculator in python kivy

  How make calculator in python We make a calculator in python using kivy module . Kivy module helps us to make android apps . First wait , If you run a kivy program in your terminal then you see a error like this To solve this problem you have to go kivy docs and follow the instruction of kivy docs.  First we have to make a virtual environment and then in the virtual environment you have to install kivy . After that you have to write  kivy_venv\Scripts\activate in your terminal and then run the file . If this method not work then write the comment below. LETS START CODING First we import kivy .For this we hve to write  from  kivy.app  import  App from  kivy.uix.label  import  Label from  kivy.uix.button  import  Button from  kivy.core.window  import  Window from  kivy.uix.gridlayout  import  GridLayout from  kivy.uix.widget  import  Widget from  kivy.lang  import ...

HOW TO MAKE SIMPLE CALCULATOR IN PYTHON

HOW TO MAKE SIMPLE CALCULATOR IN PYTHON 

To make a simple calculator we write a program in python language . 

Taking input from the user
we have to take three input from user 
1. First number 
2. Mathematical operation user want to do
3. Second number 
NOTE-mathematical operation only take ADDITION(+),SUBTRACTION(-),MULTIPLICATION(*) AND DIVISION(/)

For taking these input we have to write :

number1=int(input("Enter the 1st number:\n")) 
operation=input("Enter the operation:\n")
number2=int(input("Enter the 2nd number:\n"))

Calculating the numbers
For calculating the numbers we have to use if else condition .

When operation input is equal to (+) then input numbers will be add.
When operation input is equal to (-) then input numbers will be subtract.
When operation input is equal to (*) then input numbers will be multiply.
When operation input is equal to (/) then input numbers will be divide.
When operation input is different then  Invalid input   is displayed.

HERE ARE THE CODE





OUTPUT