Simple Calculator using Python | ICSS Student | Anik Banerjee & Subhojit Roy

Simple Calculator using Python

A Simple calculator is a machine which allows people to do math operations more easily. For example, most calculators will add, subtract, multiply, and divide. Some also do square roots, and more complex calculators can help with calculus and draw function graphs. Calculators are found everywhere. A smartphone or other computer can also act as a calculator.

Simple Calculator using Python project done by ICSS students Anik Banerjee & Subhojit Roy. By this project you will learn to create a simple calculator that can add, subtract, multiply or divide depending upon the input from the user.

 

Project Name: Simple Calculator using Python

 

Author Name: Anik Banerjee & Subhojit Roy

 

Publish Date12-07-2018

 

Project discussed below:

Description:

This is a simple calculator developed in python programming IDLE used to perform basic mathematical calculations like

Addition (+)

Subtraction (-)

Multiplication (*)

Division (/)

This program is developed via python version 3.0.

 

Simple Calculator

 

 

Source Code: 

from tkinter import *

def btnClick(num):
global op
op=op+str(num)
n.set(op)

def allClear():
global op
op=””
n.set(“”)

def equals():
global op
rslt=str(eval(op))
n.set(rslt)
op=””

def backspace():
global op
op=op[:-1]
n.set(op)

root = Tk()
root.title(“Calculator”)
root.resizable(0,0)
op=””
n=StringVar()

text= Entry(root,textvariable=n,bd=30,font=(“Arial”,20,’bold’),bg=”powder blue”,insertwidth=4,justify=’right’).grid(columnspan=4)

btn7 = Button(root,padx=16,bd=8,fg=”Green”, font=(‘Arial’,20,’bold’),text=”7″,bg=”Black”,command=lambda : btnClick(7)).grid(row=1,column=0)
btn8 = Button(root,padx=16,bd=8,fg=”Green”, font=(‘Arial’,20,’bold’),text=”8″,bg=”Black”,command=lambda : btnClick(8)).grid(row=1,column=1)
btn9 = Button(root,padx=16,bd=8,fg=”Green”, font=(‘Arial’,20,’bold’),text=”9″,bg=”Black”,command=lambda : btnClick(9)).grid(row=1,column=2)
addition = Button(root,padx=16,bd=8,fg=”Green”, font=(‘Arial’,20,’bold’),text=”+”,bg=”Black”,command=lambda : btnClick(“+”)).grid(row=1,column=3)
#=================================================================================================================
btn4 = Button(root,padx=16,bd=8,fg=”Green”, font=(‘Arial’,20,’bold’),text=”4″,bg=”Black”,command=lambda : btnClick(4)).grid(row=2,column=0)
btn5 = Button(root,padx=16,bd=8,fg=”Green”, font=(‘Arial’,20,’bold’),text=”5″,bg=”Black”,command=lambda : btnClick(5)).grid(row=2,column=1)
btn6 = Button(root,padx=16,bd=8,fg=”Green”, font=(‘Arial’,20,’bold’),text=”6″,bg=”Black”,command=lambda : btnClick(6)).grid(row=2,column=2)
sub = Button(root,padx=16,bd=8,fg=”Green”, font=(‘Arial’,20,’bold’),text=”-“,bg=”Black”,command=lambda : btnClick(“-“)).grid(row=2,column=3)
#=================================================================================================================
btn1 = Button(root,padx=16,bd=8,fg=”Green”, font=(‘Arial’,20,’bold’),text=”1″,bg=”Black”,command=lambda : btnClick(1)).grid(row=3,column=0)
btn2 = Button(root,padx=16,bd=8,fg=”Green”, font=(‘Arial’,20,’bold’),text=”2″,bg=”Black”,command=lambda : btnClick(2)).grid(row=3,column=1)
btn3 = Button(root,padx=16,bd=8,fg=”Green”, font=(‘Arial’,20,’bold’),text=”3″,bg=”Black”,command=lambda : btnClick(3)).grid(row=3,column=2)
mul = Button(root,padx=16,bd=8,fg=”Green”, font=(‘Arial’,20,’bold’),text=”*”,bg=”Black”,command=lambda : btnClick(“*”)).grid(row=3,column=3)
#=================================================================================================================
btn0 = Button(root,padx=16,bd=8,fg=”Green”, font=(‘Arial’,20,’bold’),text=”0″,bg=”Black”,command=lambda : btnClick(0)).grid(row=4,column=0)
point = Button(root,padx=16,bd=8,fg=”Green”, font=(‘Arial’,20,’bold’),text=”.”,bg=”Black”,command=lambda : btnClick(“.”)).grid(row=4,column=1)
equal = Button(root,padx=16,bd=8,fg=”Green”, font=(‘Arial’,20,’bold’),text=”=”,bg=”Black”,command=equals).grid(row=4,column=2)
division= Button(root,padx=16,bd=8,fg=”Green”, font=(‘Arial’,20,’bold’),text=”/”,bg=”Black”,command=lambda : btnClick(“/”)).grid(row=4,column=3)
#==================================================================================================================
o_brkt=Button(root,padx=16,bd=8,fg=”Green”, font=(‘Arial’,20,’bold’),text=”(“,bg=”Black”,command=lambda : btnClick(“(“)).grid(row=5,column=0)
btn_bckspc = Button(root,padx=16,bd=8,fg=”Green”, font=(‘Arial’,20,’bold’),text=”<x|”,bg=”Black”,command=backspace).grid(row=5,column=1)
btn_ac = Button(root,padx=16,bd=8,fg=”Green”, font=(‘Arial’,20,’bold’),text=”AC”,bg=”Black”,command=allClear).grid(row=5,column=2)
c_brkt=Button(root,padx=16,bd=8,fg=”Green”, font=(‘Arial’,20,’bold’),text=”)”,bg=”Black”,command=lambda : btnClick(“)”)).grid(row=5,column=3)

root.mainloop()

 

Platforms:

This application has been tested in the following platform:-

  • Windows 10.1
  • Linux Mint 18.03

 

Future Scope:

  • Upgradation to Scientific Calculator
  • New Design

 

Highest Selling Technical Courses of Indian Cyber Security Solutions:

Certified Ethical Hacker Training in Bhubaneswar

Ethical Hacking Training in Bhubaneswar

Certified Ethical Hacker Training in Bangalore

Ethical Hacking Training in Bangalore

Certified Ethical Hacker Training in Hyderabad

Ethical Hacking Training in Hyderabad

Python Training in Bangalore

Python Training in Hyderabad

Python Training in Bhubaneswar

Microsoft Azure Training in Hyderabad

Microsoft Azure Training in Bangalore

Microsoft Azure Training in Bhubaneswar

Networking Training in Bangalore

Networking Training in Hyderabad

Networking Training in Bhubaneswar

Advance Python Training in Hyderabad

Advance Python Training in Bangalore

Advance Python Training in Bhubaneswar

Amazon Web Services Training in Hyderabad

Amazon Web Services Training in Bangalore

Amazon Web Services Training in Bhubaneswar

Certified Ethical Hacker Certification – C | EH v10

Computer Forensic Training in Kolkata

Summer Training for CSE, IT, BCA & MCA Students 

Network Penetration Testing training

Ethical Hacking  training

Internet Of Things Training

Internet Of Things Training Hyderabad

Internet Of Things Training in Bhubaneswar

Internet Of Things Training in Bangalore

Embedded System Training

Digital Marketing Training

Machine Learning Training

Python Programming training

Android Training in Bangalore

Android Training in Hyderabad

Android Training in Bhubaneswar

Diploma in Network Security Training

Android Development  training

Secured Coding in Java

Certified Network Penetration Tester 

Diploma in Web Application Security 

Certified Web Application Penetration Tester 

Certified Android Penetration Tester 

Certified Python Programming 

Advance Python Training 

Reverse Engineering Training  

Amazon Web Services Training  

VMware Training 

 

Cybersecurity services that can protect your company:

Web Security | Web Penetration Testing

Network Penetration Testing – NPT

Android App Penetration Testing

Source Web Development

Source Code Review

Android App Development

Digital Marketing Consultancy

Data Recovery

 

Other Location for Online Courses:

Bhubaneswar

Bangalore

Hyderabad

 

 


Show Buttons
Hide Buttons