CS Project
CS Project
COMPUTER
SCIENCE PROJECT BY
REVANT RANJAN, ANISHEK JAIN, PODEM
GAGAN CHANDRA
XI A
BASIC PYTHON CALCULATOR
2 | Page
INDEX
PAGES CONTENT
3-4 CERTIFICATE,ACKNOWLEDGEMENT
5 OVERVIEW OF THE PROJECT
6-9 STEPS IN CREATING THE PROGRAM
10-12 EXPLANATION OF THE CODING
13-14 VARIOUS OUTPUTS OF THE
PROGRAM
15 ABOUT PYTHON
16 BIBLIOGRAPHY
3 | Page
CERTIFICATE
ACKNOWLEDGEMENT
The success and final outcome of this project was
the result of contributions by many people.Firstly,
we would like to thank to our INFORMATICS
PRACTICSES TEACHER MR. BHAGAT SINGH, who
initially gave us the opportunity to work on this
project and later helped us complete the project
on time.
We thank our honourable PRINCIPAL SIR
MR.KARMVEER SINGH for his constant support
and motivation which helped us complete our
project sincerely.
It would not be fair if we don’t thank our parents
and our classmates for their help and determined
support which helped our personal motivation
and ambition towards the completion of this
project.
PLACE: NAME:
5 | Page
SOME FEATURES –
• Basic Arithmetic Operations: Addition, Subtraction,
Multiplication, and Division.
• Error Handling: Prevents division by zero and invalid
inputs.
• User-Friendly Interface: Interactive and intuitive
console-based selection system.
• Continuous Execution: Allows multiple calculations until
the user decides to exit.
• Lightweight & Efficient: Simple logic with minimal
resource consumption.
6 | Page
3. Error Handling:
o Use try-except blocks to handle invalid
inputs (e.g., non-numeric values).
o Check for division by zero in the division
function.
4. Continuous Use:
o Use a loop to allow the user to perform
multiple calculations.
o Provide an option to exit the calculator.
7 | Page
except ValueError:
print("Error: Invalid input. Please enter numeric values.")
5. Display Results:
o Print the result of the calculation.
o Display appropriate error messages if
invalid inputs or operations are
encountered.
10 | Page
3. Error Handling:
o A try-except block is used to handle invalid
inputs (e.g., non-numeric values).
o The divide function includes a check for division
by zero and raises an error if detected.
11 | Page
Example Workflow:
1. User selects addition:
o Input: 1 (for addition), 10 (first
number), 5 (second number).
o Output: Result: 10.0 + 5.0 = 15.0.
2. User selects division by zero:
o Input: 4 (for division), 10 (first number), 0 (second
number).
o Output: Error: Division by zero is not allowed.
3. User enters invalid input:
o Input: 2 (for subtraction), ten (first number).
12 | Page
Example 1: Addition
Example 4: Exit
15 | Page
ABOUT PYTHON
Python is an interpreted, high-level and general-purpose programming
language. Python's design philosophy emphasizes code readability with its
notable use of significant indentation. Its language constructs and object-
oriented approach aim to help programmers write clear, logical code for
small and large-scale projects.[29]
Python is dynamically-typed and garbage-collected. It supports
multiple programming paradigms,
including structured (particularly, procedural), object-
oriented and functional programming. Python is often described as a
"batteries included" language due to its comprehensive standard library.[30]
Python was created in the late 1980s, and first released in 1991, by Guido
van Rossum as a successor to the ABC programming language. Python 2.0,
released in 2000, introduced new features, such as list comprehensions,
and a garbage collection system with reference counting, and was
discontinued with version 2.7 in 2020.[31] Python 3.0, released in 2008, was
a major revision of the language that is not completely backward-
compatible and much Python 2 code does not run unmodified on Python 3.
With Python 2's end-of-life (and pip having dropped support in 2021[32]),
only Python 3.6.x[33] and later are supported, with older versions still
supporting e.g. Windows 7 (and old installers not restricted to 64-bit
Windows).
Python interpreters are supported for mainstream operating systems and
available for a few more (and in the past supported many more). A global
community of programmers develops and maintains CPython, a free and
open-source[34] reference implementation. A non-profit organization,
the Python Software Foundation, manages and directs resources for Python
and CPython development.
As of February 2021, Python ranks third in TIOBE’s index of most popular
programming languages, behind C and Java,[35] having previously gained
second place and their award for the most popularity gain for 2020.
16 | Page
Bibliography
● https://en.wikipedia.org
● https://www.google.co.in
● https://WWW.W3SCHOOLS.COM
● CLASS 11 COMPUTER SCIENCE by sumita
arora
● https://WWW.TUTORIALSPOINT.COM