ABSTRACT
We're going to use what we've learned up to this point in this project to build a straightforward calculator.
It's a fun project to work on. Building this project you
would learn to design a graphical UI and make you familiar with a library like
Tkinter. This library enables you to create buttons to perform different
operations and display results on the screen.
ACKNOWLEDGEMENT
All praises and thanks to Almighty "ALLAH ", the most merciful, the most gracious,
the source of knowledge and wisdom endowed to mankind, who conferred us with the power of mind
and capability to take this project to the exciting ocean of knowledge.
All respects are for our most
beloved
Holy
Prophet
“HAZRAT MUHAMMAD(Peace Be Upon Him)”, whose
personality will always be
source of guidance for humanity.
Acknowledgement is due to Institute Name for
support of this Project, a highly appreciated achievement for us in the undergraduate level.
We wish to express our appreciation to our Teacher Name who served as our major advisor. We would like to express our heartiest gratitude for their keen guidance, sincere help and friendly manner which
inspires us to do well in the project and makes it a reality.
Many people, especially our classmates and team
members itself, have made valuable comment suggestions on this proposal which
gave us an inspiration to improve our project. We thank Teacher Name & all the people for their help directly and
indirectly to complete our project.
Table of Contents
|
| |
INTRODUCTION
The Python programming language is an incredible instrument
to utilize while working with numbers and assessing numerical articulations.
This quality can be used to make programs that are useful.
A learning activity that demonstrates how to create a Python 3 command-line
calculator program is presented in this tutorial. Although the final step of
this guide serves as a starting point for how you can improve the code to
create a more robust calculator, this calculator will only be able to perform
basic arithmetic.
In this project we created a Simple Calculator using the basic concept of python programming. In this program we just use simple coding method to create a wonderful game which like by everyone.
In this venture we will bring all that we have adapted so far together to make a straightforward number cruncher.
This task is an energizing, Building this undertaking you would figure out how to plan a graphical UI and make you acquainted with a library like Tkinter. This library empowers you to make catches to perform various tasks and show results on the screen.
CODING:
""" Calculator
----------------------------------------
"""
def addition ():
print("Addition")
n =
float(input("Enter the number: "))
t = 0 #Total
number enter
ans = 0
while n != 0:
ans = ans + n
t+=1
n =
float(input("Enter another number Or Press Zero to calculate: "))
return [ans,t]
def subtraction ():
print("Subtraction");
n = float(input("Enter
the number: "))
t = 0 #Total
number enter
sum = 0
while n != 0:
ans = ans - n
t+=1
n =
float(input("Enter another number Or Press Zero to calculate: "))
return [ans,t]
def multiplication ():
print("Multiplication")
n =
float(input("Enter the number: "))
t = 0 #Total
number enter
ans = 1
while n != 0:
ans = ans * n
t+=1
n =
float(input("Enter another number Or Press Zero to calculate: "))
return [ans,t]
def average():
an = []
an = addition()
t = an[1]
a = an[0]
ans = a / t
return [ans,t]
# main...
while True:
list = []
print("
CALCULATOR PROGRAM !")
print("
Simple Calculator in python by ANZAL IFTIKHAR & FAHAD AHMED")
print(" Enter
'a' for addition")
print(" Enter
's' for substraction")
print(" Enter
'm' for multiplication")
print(" Enter
'v' for average")
print(" Enter
'q' for quit")
c = input("
")
if c != 'q':
if c == 'a':
list =
addition()
print("Ans = ", list[0], " total inputs ",list[1])
elif c == 's':
list =
subtraction()
print("Ans = ", list[0], " total inputs ",list[1])
elif c == 'm':
list = multiplication()
print("Ans = ", list[0], " total inputs ",list[1])
elif c == 'v':
list =
average()
print("Ans = ", list[0], " total inputs ",list[1])
else:
print
("Sorry, invilid character")
else:
break
RESULTS
After coding on python and then running
i got following results.
CONCLUSIONS
The main objective of the python simple calculator is to entertain
the users by using it.
REFERENCES
- Google
-
YouTube Tutorials
-
Teacher Guidance
0 Comments