You are on page 1of 24

FORM VALIDATION

MAHARASHTRA STATE BOARD OF TECHNICAL


EDUCATION
MIT POLYTECHNIC PUNE
MICRO PROJECT
Academic year 2022-2023

"Calculator using Python"

Program: Computer Engineering


Program Code: CO6I

Course: Python Programming Language (PWP)


Course Code: 22616

Prof. Mrs. P. S. Patil Prof. Dr. J. G. Mante


[Name of Guide] [Name of HOD]

1
FORM VALIDATION

MAHARASHTRA STATE BOARD OF TECHNICAL


EDUCATION

Certificate
This is to certify that Mr./Ms.Narmada Nayak. Roll.No: 78 of 6th Semester of
Diploma in Computer Engineering of Institute: MIT Polytechnic Pune (Code:0148)
has completed the Micro Project satisfactorily in Subject: Python Programming
Language (PWP)(22616) for the academic year 2022-2023 as prescribed in the
curriculum

Date: Seat No:

Place: Pune Enrollment No: 2001480103

Subject Teacher Head of the Department Principal


Prof.Mrs.P.S.Patil. Prof. Dr. J. G. Mante Prof.Dr. R.S.
Kale

2
FORM VALIDATION

Student/Group Details (if group is applicable):

SR.N NAME ROLL.N ENROLLMEN SEA


O O. T NO. T
NO.
1 Narmada 78 2001480103
Nayak

Guide By: Prof. Mrs. P. S. Patil

3
FORM VALIDATION

INDEX.

Sr.no Title Page.no

1. Introduction 5

2. Micro Proposal- A 15

3. Information on Topic 20

4. Program Code 24

5. Output 26

6. Micro Proposal- B 32

7. Evaluation Sheet 36

4
FORM VALIDATION

Annexure-I
A MICRO PROJECT ON
"Calculator Using Python"

1.0 Aims/Benefits of the micro project

To learn about python programming language.


To get Information about how to create a calculator in python.
Gain Knowledge about the programming language.

2.0 Course outcome addressed.

a) Display message on screen using Python script on IDE.


b) Develop a python program to demonstrate use of Operators
c) Perform operations on data structures in Python.
d) Develop functions for given problem.
e) Design classes for given problem.
f) Handle exceptions.

3.0 Proposed methodology

1. Focused on the selection of an appropriate topic for the micro-project.


2. Select the topic i.e. To Prepare a report on Calculator using python.
3. Brief study on our topic.
4. Gather all information based on the topic of the micro project.
5. Analysis and study of our topic in detail.
6. Following all the above methodologies we successfully completed our microproject.

5
FORM VALIDATION
4.0 Action Plan

Sr No. Details Planned Planne Name of


of Start d Responsible
activity Date Finish team member
ed
Date
1 Searching for 07/04/2023 07/04/2023
topic
2 Surveying 08/04/2023 09/04/2023
Information
3 Requireme 10/04/2023 10/04/2023
nt
Narmada
Analysis Nayak
4 Finalizing 12/04/2023 12/04/2023
Layout
5 Generating 13/04/2023 13/04/2023
Program and
Final
Execution
6 Report 14/04/2023 14/04/2023
Generation
7 Final 16/04/2023 16/04/2023
Submission

6
FORM VALIDATION

5.0 Resources required:

Sr.No. Name of Specification Quantity Remarks


Resources/materi
al
1 Computer System 16 GB RAM,
Windows 11 OS 1
Python 3

2 Office MS office or
software Libre Office
Package
3 Software required
1

7
FORM VALIDATION

Annexure-II
Micro-Project Report
A MICRO PROJECT ON "Calculator Using Python"

1.0 Brief Introduction/Rationale

Creating evaluations and manipulating the variables to make them work as per the requirement
is what drives python programming as an easy and significant tool. With the aid of the below
module, we shall be analyzing the various python topics studied so far to apply the learnings
and create a calculator program in python.

The article below will help us learn an easy command-line calculator program in Python 3,
where we shall explore arithmetic operators, functions in python, and conditional statements.
And will learn how to handle user input to put together our calculator program in python.

Scope

The module considers the user to be well versed in a few below-given topics in python.
Functions in Python.
Function Arguments in Python.
User-defined Functions in Python.

The module enables you to go through a calculator program in python that can execute basic
arithmetic operations like add, subtract, multiply, or divide. The module considers the guide
utilized to install Python 3 on their local computer and set up the programming environment on
their machine.

Introduction to Calculator Program in Python

We shall be breaking down our procedure of making the calculator program in python into
simple steps. To assist understand the concepts in depth, for making a simple calculator
program in python that can execute basic mathematical operations such as addition,
subtraction, multiplication, or division, all of which rely upon the input given by the user.

The process that we shall be following is very straightforward to understand.

- Prompting Input from the User. That is, we shall be accepting input for two variables.
- Define and Add operators or functions such as add(), subtract(), multiply(), and divide()
to estimate respective functions.
- To make it similar to the calculator, apply conditional statements (if…elif…else

8
FORM VALIDATION
branching) to make it works as per User’s choice.
Simple Calculator by Using Functions

Let us dive in and learn by executing each step toward creating a calculator program in python.

Step 1: Prompting Input from the User, we shall accept input for two variables.

In this step, we shall take the user's input utilizing the input() function in python. It is the
same as when we enter numbers in a real calculator to execute any arithmetic operations.
We shall ask the user to input two variables utilizing each variable's input() function.

Let’s have the program execute the prompt for the two numbers:

Code

number_1 = input('Please, Enter the first number:


number_2 = input('Please, Enter the second number: ')

Output:

Enter the first number: 20


Enter the second number: 10

Step 2: Define and Add operators or functions such as add (), subtract(), multiply(), and
Divide () to estimate respective functions.

Now we are adding the functions to execute the mathematical operations such as addition,
subtraction, multiplication, and division to make the computation for the calculator program in
python. We also changed our input functions to integers to guide the user to perform the
arithmetic operations on integers, not strings.

Code:

number_1 = int(input('Please, Enter the first number: '))


number_2 = int(input('Please, Enter the second number: '))

# arithematic operation: Addition


print('{} + {} = '.format(number_1, number_2))
print(number_1 + number_2)
9
FORM VALIDATION

# arithematic operation: Subtraction


print('{} - {} = '.format(number_1, number_2))
print(number_1 - number_2)

# arithematic operation: Multiplication


print('{} * {} = '.format(number_1, number_2))
print(number_1 * number_2)

# arithematic operation: Division


print('{} / {} = '.format(number_1, number_2))
print(number_1 / number_2)

Output:

Please, Enter the first number: 10


Please, Enter the second number: 20
10 + 20 =
30
10 - 20 =
-10
10 * 20 =
200
10 / 20 =
0.5

Above, we have represented each of the four basic arithmetic operations in


python utilizing the format () function. Format () functions fill the
placeholder and create the output formatted. The user's input was now
calculated for each arithmetic operation we defined.

As all the functions are getting performed expressed for the two numbers,
we have to make it work per the user's choice. We shall utilize conditional
statements - if…elif…else branching so that it only performs the operations
based on the user’s selection of operation like in a real calculator.

10
FORM VALIDATION

Step3: To create it identical to a calculator, apply conditional


statements (if…elif…else branching) to create it works as per User’s
selection

To create it at the user's choice based, we shall be defining each of the


arithmetic operations as a function utilizing the def function in python. We
will again ask for the user's input for the mathematical operations that they
want to execute.

Code:
# Function to perform the arithmetic operation: Addition
def add(number_1, number_2):
return number_1 + number_2

# Function to perform the arithmetic operation: Subtraction


def subtract(number_1, number_2):
return number_1 - number_2

# Function to perform the arithmetic operation: Multiplication


def multiply(number_1, number_2):
return number_1 * number_2

# Function to perform the arithmetic operation: Division


def divide(number_1, number_2):
return number_1 / number_2

11
FORM VALIDATION
print("Hi, I am a Calculator!")
print("Please select which of the following arithematic operation you want
me to perform-\n" \
"1. Add\n" \
"2. Subtract\n" \
"3. Multiply\n" \
"4. Divide\n")

# Taking the input from the user for which arithmetic operation to perform
operation = int(input(" 1, 2, 3 or 4 :"))

number_1 = int(input('Please, Enter the first number: '))


number_2 = int(input('Please, Enter the second number: '))

if operation == 1:
print(number_1, "+", number_2, "=",
add(number_1, number_2))

elif operation == 2:
print(number_1, "-", number_2, "=",
subtract(number_1, number_2))

elif operation == 3:
print(number_1, "*", number_2, "=",
multiply(number_1, number_2))

elif operation == 4:

12
FORM VALIDATION
print(number_1, "/", number_2, "=",
divide(number_1, number_2))
else:
print("Please enter Valid input")

Output:

Hi, I am a Calculator!
Please select which of the following arithmetic operation you want to
perform-
1. Add
2. Subtract
3. Multiply
4. Divide

1, 2, 3 or 4 :3
Please, Enter the first number: 10
Please, Enter the second number: 20
10 * 20 = 200

13
FORM VALIDATION
2.0 Actual Resources Use

Sr. Name of Specifications Quantity


no Resource
material
1. Computer 12 GB RAM,
System Windows 11 1
OS
2. Internet Youtube /
Wikipedia
3. Textboo PWP 22616
k/Manual 1
Programing
With Python

3.0 Skill Developed

1. Teamwork

2. Communication skills

3. Able to get all information about how to create a calculator using


python.

14
FORM VALIDATION
4.0 Outputs of the Micro-Project

We created our calculator program in python established on the user's


choice of input of numbers and operators, precisely how a real calculator
works.

The pre-requisites for developing a calculator program in python are as


below:

 Functions in Python
 Function Arguments in Python
 User-defined Functions in Python

The approach toward creating the calculator program in python is as below:

 Accepting input from the user for two variables.


 Defining functions such as add(), subtract(), multiply(), and
divide() to calculate respective functions.
 Adding conditional statements (if…elif…else branching) to create
it works as per the User’s selection

15
FORM VALIDATION

16
FORM VALIDATION

17
FORM VALIDATION

18
FORM VALIDATION

19
FORM VALIDATION

20
FORM VALIDATION

Micro Project Proposal-B

1.0 Brief Introduction:

Forms are used in webpages for the user to enter their required
details that further send it to the server for processing. A form is
also known as a web form or HTML form. This form is used to
validate the form. Username, password, contact information are
some details that are mandatory in forms.

2.0 Aim of the Micro-Project:

i) To learn about python programming language.


ii) To get Information about how to create a calculator in python.
iii) Gain Knowledge about the programming language.

3.0 Actual Procedure Followed:


(i) Searching the topic.
(ii) Searching information about the topic from net.

4.0 Actual Resources used:


(i) Windows.
(ii) MS Word.

5.0 Skill Developed/learning out of this Micro-Project:

21
FORM VALIDATION

Micro-Project Evaluation Sheet

R Stude Enrollme Process Assessment Product Assessment Tota


ol nt nt l
l Name number Mar
n ks
o. (10)
Part A Project Part B Individual
Projec Methodolog Projec Presentati
t y (2) t on
Propo Repor /Viva (4)
sal t/
(2) worki
ng
mo
del
(2)

78 200148010
N 3
a
r
m
a
d
a

N
a
y
a
k

Note: Every course teacher is expected to assign marks for group evaluation in first 3 columns and
individual evaluation in 4 columns for each group of students as per rubics.
Comments/Suggestion about team work/leadership/inter-personal communication (if any).

22
FORM VALIDATION

Any other Comment:

Name and designation of the Faculty Member: Prof.Mrs. P. S. Patil.


Signature: _

23
FORM VALIDATION

24

You might also like