Python have a capability to makes code optimize and make everything easy to create so we can create a mini calculator in python very easily and in just 13 to 14 line code. We use IDLE (python 3.5) to create this project.
Lets go,
Now, we start creating our calculator step by step.
Step 1: Open IDLE (python 3.5). After launching IDLE(python 3.5) a window is visible as in the following screenshot:
Open a new file for write our source code (shown in picture),
New file is open and ready to write our code....(shown in picture),
Step 2: write our source code
Firstly, we have to do import all module (namespace) used in this project,
- from tkinter import * # this module contains graphic function
- from math import * #this module contains mathematics function
We shall move further, now we define a function that execute our expression and read value from text box.