Csc
Csc
Csc
5
The main objective of this project is to bridge theoretical knowledge
and practical implementation. It demonstrates how to use Python's
built-in capabilities to create a functional and user-friendly
application. Moreover, it highlights the importance of writing clean,
organized, and well-documented code to ensure that the program is
easy to read and maintain.
6
OBJECTIVE
The primary objective of this project is to design and implement a
Python-based simple calculator that performs basic arithmetic
operations such as addition, subtraction, multiplication, and division.
This project aims to provide users with a straightforward and
interactive tool for performing essential mathematical calculations
efficiently and accurately.
Addition:
Addition is one of the four basic arithmetic operations and
is a fundamental feature of any simple calculator. The operation
involves calculating the total or sum of two or more numbers. In the
context of the calculator, users input two numbers, and the program
performs the addition to return the result.
Example:
5+7=12
Subtraction:
Subtraction is another fundamental arithmetic operation
featured in a simple calculator. It involves finding the difference
between two numbers by deducting the second number from the
first. This operation is commonly used in mathematics and everyday
calculations.
Example:
15−8=7
7
Multiplication:
Multiplication is one of the essential arithmetic
operations included in a simple calculator. It involves combining
equal groups of a number, effectively scaling one number by
another. This operation is widely used in mathematics, science, and
everyday tasks.
Example:
6×4=24
Division:
Division is a fundamental arithmetic operation included in
a simple calculator. It involves splitting a number (the dividend) into
equal parts, as determined by another number (the divisor). The
result, called the quotient, shows how many times the divisor fits
into the dividend.
Example:
20÷4=5
8
FLOW CHART
9
SOURCE CODE
import mysql.connector as mc
mycon=mc.connect(host='localhost',username='root',password='roo
t',database='calculator')
cur=mycon.cursor()
def add(user):
no1=int(input('enter no.1:'))
no2=int(input('enter no.2:'))
a=no1+no2
print(a)
cur.execute(q)
def sub(user):
no1=int(input('enter no.1:'))
no2=int(input('enter no.2:'))
a=no1-no2
print(a)
cur.execute(q)
def multi(user):
10
no1=int(input('enter no.1:'))
no2=int(input('enter no.2:'))
a=no1*no2
print(a)
cur.execute(q)
def div(user):
no1=int(input('enter no.1:'))
no2=int(input('enter no.2:'))
a=no1/no2
print(a)
cur.execute(q)
def login(a,b):
data=cur.fetchall()
c=[]
for i in data:
c.append(i)
11
if (a,b) in c:
return('y')
else:
return('n')
print('wrong password/user')
def history(user):
data=cur.fetchall()
for i in data:
if i[4]==user:
print(i)
#Main
p=login(user,password)
while p=='y':
print('1.addition')
print('2.subraction')
12
print('3.multiplication')
print('4.devision')
if car == 1:
add(user)
if car == 2:
sub(user)
if car == 3:
multi(user)
if car == 4:
div(user)
else:
13
SOURCE CODE IN IDLE:
14
SAMPLE INPUT/OUTPUT
Addition :
SUBRACTION :
15
Multiplication:
Division:
History:
16
CONCLUSION
In this project, we have successfully built a simple calculator using
Python, which performs the four basic arithmetic operations:
addition, subtraction, multiplication, and division. The purpose of the
project was to create an interactive tool that allows users to input
two numbers, choose an operation, and obtain the result.
Throughout the development, the project focused on utilizing
Python's core programming features, such as handling user input,
using conditional statements, and implementing basic arithmetic
operators.
18
HARDWARE AND SOFTWARE
SOFTWARES:
1. Python
2. MySQL
Hardware:
1. Ram: 4Gb ram(Minimum)
2. Storage: 255Gb(Minimum)
3. Processor: Intel Pentium
19
BIBLIOGRAPHY
CHATGPT- Chatgpt.com
GOOGLE- Google.com
Software used:
1.Python
2. MySQL
20