Caculator
Caculator
A
PROJECT REPORT
ON
CALCULATOR IN PYTHON
Session 2023-24
PGDCA [Sem-II]
GUIDED BY SUBMITTED BY
[Mr. DILEEP SAHU SIR] [ROSHAN KUMAR]
(Assistant Professor) [ROSHANI YADAV]
SUBMITTED TO
DEPARTMENT OF COMPUTER SCIENCE
GOVT. V.Y.T. PG AUTONOMOUS COLLEGE DURG, CHHATTISGARH, INDIA
E-R Diagram
CONTENT
• Objective
• Introduction
• Scope
• System Requirement
• Coding
• Output
• E-R Diagram
• Advantage & Disadvantage
• Conclusion
Certificate of Approval
This is to certify that the Project work entitled “CALCULATOR IN PYTHON”
is carried out by ROSHAN KUMAR, student of PGDCA[Sem-II]. At GOVT.
V.Y.T. PG AUTONOMOUS COLLEGE DURG, C.G., INDIA is hereby
approved as a credible work in the discipline of Computer Science & Information
Technology for the award of degree of POST GRADUATE DIPLOMA IN
E-R Diagram
COMPUTER APPLICATION during the year 2023-24 from “HEMCHAND
YADAV UNIVERSITY DURG, C.G.”
HOD
DEPT. OF COMP. SCIENCE
(Guide Name)
DEPT. OF COMP. SCIENCE
CERTIFICATE OF EVALUATION
This is to certify that the Project work entitled “CALCULATOR IN PYTHON”
is carried out by Ms. “ROSHAN KUMAR”, a student of PGDCA[Sem-II]. At
GOVT. V.Y.T. PG AUTONOMOUS COLLEGE DURG, C.G., INDIA after
proper evaluation and examination, is hereby approved as a credible work in the
discipline of Computer Science and is done in a satisfactory manner for its
acceptance as a requisite for the award of degree of POST GRADUATE
DIPLOMA IN COMPUTER APPLICATION during the year 2023-24 .
DECLARATION
This to certify that the Project report entitled “CALCULATOR IN
PYTHON”,which is submitted by me in the partial fulfillment for the award of
thedegree of POST GRADUATE DIPLOMA COMPUTER APPLICATION,
GOVT. V.Y.T. PG AUTONOMOUS COLLEGE DURG, C.G., INDIA
comprises the original work carried out by me.
I further declare that the work reported in this project has not been submitted and
will not be submitted, either in part or in full for the award of any other degree or
diploma in the institute or any other Institute or University.
ACKNOWLEDGEMENT
It is great pleasure to present project report entitled “CALCULATOR IN
PYTHON” submitted to the Department of Computer Science to fulfill the POST
GRADUATE DIPLOMA IN COMPUTER APPLICATION to GOVT. V.Y.T.PG
AUTONOMOUS COLLEGE, DURG (C.G).
Finally we are also grateful to our Principal sir and all those who directly or
indirectly helped us for the successful completion of this project report.
SUBMITTED BY
ROSHAN KUMAR
E-R Diagram
INTRODUCTION
This Python program is designed to assist you with your everyday calculations
swiftly and accurately. Whether you're adding up expenses, figuring out
percentages, or solving complex mathematical problems, Python Calculator is
here to simplify your tasks.
OBJECTIVE
1.User-Friendly Interface: Create a user-friendly interface with clear instructions and prompts.
2.Handling Decimal Numbers: Ensure accurate calculations with decimal numbers.
3.Error Handling: Implement error handling for cases like division by zero or invalid inputs.
4.Acessibility: Ensure the calculator is accessible to users with disabilities by following accessibility
guidelines.
E-R Diagram
SCOPE
Basic Arithmetic Operations: The calculator should support
fundamental arithmetic operations such as addition,
subtraction, multiplication, and division. These operations form
the backbone of any calculator.
Error Handling: The calculator should handle errors gracefully,
especially division by zero. It should provide clear error
messages to the user when invalid inputs or operations are
attempted.
SYSTEM REQUIREMENT
E-R Diagram
Python Interpreter: The primary requirement is a Python
interpreter installed on the system. Python is supported on
various platforms including Windows, macOS, and Linux. The
calculator should be compatible with the version of Python
installed on the user's system.
Operating System: Python calculators are typically platform-
independent, meaning they can run on any operating system
where Python is supported. This includes Windows, macOS,
Linux, and others.
Hardware Requirements: Since a calculator is a lightweight
application, it does not demand significant hardware resources.
Any modern computer or device capable of running Python
should suffice. This includes desktops, laptops, and even smaller
devices like Raspberry Pi.
coding:
import sqlite3
import tkinter as tk
from tkinter import messagebox
class Calculator:
def __init__(self, root):
self.root = root
self.root.title("Calculator")
class Calculator:
def __init__(self, root):
self.root = root
self.root.title("Calculator")
self.expression_var = tk.StringVar()
self.expression_var.set("")
self.entry = tk.Entry(root,
textvariable=self.expression_var, font=('Arial', 14),
bd=10, insertwidth=4,
width=25, bg="powder
blue", justify='right')
self.entry.grid(row=0, column=0,
columnspan=4)
buttons = [
('7', 1, 0), ('8', 1, 1), ('9', 1, 2),
('/', 1, 3),
('4', 2, 0), ('5', 2, 1), ('6', 2, 2),
('*', 2, 3),
('1', 3, 0), ('2', 3, 1), ('3', 3, 2),
('-', 3, 3),
('0', 4, 0), ('C', 4, 1), ('=', 4, 2),
('+', 4, 3),
]
if value == '=':
try:
result = eval(current_expression)
self.expression_var.set(str(result))
self.expression_var.set(current_expression + value)
E-R Diagram
def main():
root = tk.Tk()
calculator = Calculator(root)
root.mainloop()
if __name__ == "__main__":
main()
self.expression_var.set("")
self.entry = tk.Entry(root,
textvariable=self.expression_var, font=('Arial', 14),
bd=10, insertwidth=4,
width=25, bg="powder
blue", justify='right')
self.entry.grid(row=0, column=0,
columnspan=4)
buttons = [
('7', 1, 0), ('8', 1, 1), ('9', 1, 2),
('/', 1, 3),
('4', 2, 0), ('5', 2, 1), ('6', 2, 2),
('*', 2, 3),
('1', 3, 0), ('2', 3, 1), ('3', 3, 2),
('-', 3, 3),
('0', 4, 0), ('C', 4, 1), ('=', 4, 2),
('+', 4, 3),
E-R Diagram
]
if value == '=':
try:
result = eval(current_expression)
self.expression_var.set(str(result))
self.expression_var.set(current_expression + value)
def main():
root = tk.Tk()
calculator = Calculator(root)
root.mainloop()
if __name__ == "__main__":
main()
output:
E-R Diagram
E-R Diagram
E-R Diagram
ADVANTAGES:
Ease of Use: Python calculators are generally
straightforward and intuitive, making them accessible to
users of all levels, including beginners.
Platform Independence: Python is a cross-platform
language, meaning the calculator can run on various
operating systems without modification, including
Windows, macOS, and Linux.
Flexibility: Python's versatility allows for easy
customization and expansion of the calculator's features
to meet specific needs. Users can modify the calculator
or add new functions as required.
DISADVANTAGES:
Performance: Compared to compiled languages like C or C++,
Python may be slower in executing certain operations,
especially for complex calculations or large datasets.
Limited Graphical Capabilities: Simple Python calculators may
lack advanced graphical user interfaces (GUIs) or visualization
features found in more specialized software.
Dependency on Python Interpreter: Users must have Python
installed on their systems to run the calculator, which may pose
compatibility issues or require additional setup for users who
are not familiar with Python.
E-R Diagram
CONCLUSION:
In conclusion, a Python calculator offers a
range of advantages such as ease of use,
platform independence, flexibility, rapid
development, abundance of resources, and
integration capabilities. Its simplicity and
intuitive nature make it accessible to users of
all levels, while its cross-platform compatibility
ensures that it can run on various operating
systems without modification.