0% found this document useful (0 votes)
13 views10 pages

Python Micro Project

The document is a micro project report on creating a digital calculator using Python, submitted by student Omkar Ravindra Sarak under the guidance of Prof. Bandal. It outlines the project's objectives, implementation details, and includes a program code for a graphical user interface calculator. The report emphasizes the educational value of the project in reinforcing programming concepts and problem-solving skills.

Uploaded by

omkarsarak143
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views10 pages

Python Micro Project

The document is a micro project report on creating a digital calculator using Python, submitted by student Omkar Ravindra Sarak under the guidance of Prof. Bandal. It outlines the project's objectives, implementation details, and includes a program code for a graphical user interface calculator. The report emphasizes the educational value of the project in reinforcing programming concepts and problem-solving skills.

Uploaded by

omkarsarak143
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Navsahyadri Education Society's

Group of Institutions
(Polytechnic)

Sr.No.69,70,71, Naigaon [Nasarapur],


Tal- Bhor, Pune-412213.
website: https://www.navsahyadri.edu.in/

Topic Name

Digital Calculator Using Python

MICRO PROJECT REPORT


Submitted in Summer 25

Sr. Roll No: Enrollment Seat No


Name of the student
No No

1 28 Omkar Ravindra Sarak 2215150225 264604

Under the Guidance of


Prof. Bandal. S. S
At
Navsahyadri Education Society's
Group of Institutions (Polytechnic)
Sr.No.69,70,71, Naigaon [Nasarapur],
Tal- Bhor, Pune-412213.
website: https://www.navsahyadri.edu.in/
MAHARASHTRA STATE BOARD OF
TECHNICAL EDUCATION, MUMBAI

Certificate
This is to certify that Mr. Omkar Ravindra Sarak Roll No: 28
of Sixth Semester of Diploma Programming in Engineering
& Technology at 1515–NIT Polytechnic Pune, has completed
the Micro Project satisfactorily in Subject Python Programming
[22616] in the academic year 2024-2025 as per the MSBTE
prescribed curriculum of I Scheme.

Place: Pune Enrollment No: 2215150225

Date: / /2025 Exam. Seat No: 264604

Project Guide Head of the Department Principal

Seal Of
Institue
Index..

Sr. No Title Page No

1 Abstract and Introduction

2 Objectives (Cos)

3 Main Body / Content

4 Program & Output

4 Conclusion / Learning Outcomes

5 Literature Review and References

6 Weekly Work / Progress Report

7 Evaluation Sheet
Abstract
The Rock-Paper-Scissors game is a simple yet popular hand game
played worldwide. It is a two-player game where each player
simultaneously selects one of three possible choices—rock, paper, or
scissors. The rules governing the game are straightforward: rock
crushes scissors, scissors cut paper, and paper covers rock. The
objective is to determine a winner based on these predefined rules. This
project implements the game using Python, allowing a single user to
compete against the computer.

The program is developed using Python’s core functionalities,


particularly utilizing the random module to enable the computer to
make random selections, ensuring an unpredictable and fair gaming
experience. User input is taken through the console, and conditional
statements are used to compare the choices and determine the winner.

The game includes a loop mechanism to allow multiple rounds of play,


and the results are displayed after each round. Additionally, score
tracking is incorporated to maintain a record of wins, losses, and ties
over multiple rounds.

This project serves as an excellent introduction to fundamental


programming concepts, including conditional statements, loops,
functions, and user input handling. It is a beginner-friendly project that
reinforces problem-solving skills while enhancing logical thinking and
code structuring abilities. The simplicity of the game makes it an ideal
starting point for Python programming, yet it can be expanded further.
Possible enhancements include implementing a graphical user interface
(GUI), adding multiplayer functionality, or incorporating artificial
intelligence to predict and adapt to player strategies.

Overall, the Rock-Paper-Scissors game in Python is a fun and


educational project that demonstrates the power of basic programming
constructs while providing an engaging experience for users.
Introduction To The Topic
Digital Calculator Using Python

• What Is Digital Calculator ?


A digital calculator in Python is a software application designed to perform
arithmetic calculations (such as addition, subtraction, multiplication, division)
and possibly more complex operations, depending on its capabilities. The
"digital" aspect comes from how the calculator displays results in a numerical
format (either in a text-based or graphical way), similar to how a physical digital
calculator works.

• Types of Digital Calculators in Python:

1. Text-Based (Console) Calculator:

o This type of calculator operates purely through text and is typically


run in a terminal or command-line interface (CLI).
o User Interaction: The user is prompted to input numbers and choose
mathematical operations via text (such as typing +, -, *, or /).
o Display: Results are shown in plain text on the console screen.
o Operations: It can handle basic arithmetic operations (addition,
subtraction, multiplication, division), and possibly other operations
like square roots or exponents, depending on how the program is
written.
o Input Method: The user enters the numbers and operations as text or
through keyboard keys, and the program processes them to show the
result.

• Example of Interaction:
The user types:
o "Enter first number: 5"
o "Enter second number: 3"
o "Select operation: 1 (Addition)"
o The program shows: "5 + 3 = 8"
2 .Graphical User Interface (GUI) Calculator:

• This type of calculator is built with a graphical interface using a library like
tkinter in Python. It resembles a physical digital calculator with buttons for
numbers and operations.
• User Interaction: The user interacts with the calculator by clicking on
buttons (representing numbers, operators, and other functions).
• Display: It shows a digital display (often a text field or screen on the
window) where numbers and the results of operations are shown.
• Operations: Similar to a physical calculator, it supports operations like
addition, subtraction, multiplication, division, and may even support
scientific functions (e.g., square roots, trigonometric functions).
• Input Method: The user clicks on buttons for input, and the result is
displayed directly on the screen of the GUI.
Example of Interaction:
• The user clicks on buttons:
o "5", "+", "3", "="
o The display shows: "8"

• Key Features of a Digital Calculator :

1. Arithmetic Operations:
o The core function of any digital calculator is to perform basic
arithmetic operations like:
▪ Addition: Adding two numbers together.
▪ Subtraction: Finding the difference between two numbers.
▪ Multiplication: Multiplying two numbers.
▪ Division: Dividing one number by another (with checks for
division by zero).

2. User Interface:
o Text-based Calculator: The user interacts through the terminal or
command line, entering inputs via keyboard and seeing results in
text format.
o Graphical Calculator: The user interacts through a visual interface
with buttons for each number, operation, and result. It provides a
more intuitive and interactive experience.

3. Error Handling:
o The calculator should handle invalid inputs (such as dividing by
zero) and inform the user with an appropriate error message. For
example, if a user tries to divide a number by zero, the calculator
should show an error like "Cannot divide by zero" instead of
crashing.
o
4. Scientific/Advanced Functions (optional):
o A more advanced digital calculator can support scientific
calculations, such as:
▪ Square roots
▪ Exponents
▪ Trigonometric functions (e.g., sine, cosine, tangent)
▪ Logarithms

5. Memory Functions (optional):


o Some calculators have memory functions (like M+, M-, MR, MC)
to store and recall previous results, which might also be added to a
Python calculator for more advanced use cases.

• How It Works:

• Input: The user provides input, either through typing (for text-based
calculators) or by pressing buttons (for GUI-based calculators).
• Processing: The calculator processes the input, performs the arithmetic
operation(s), and computes the result.
• Output: The result is then displayed back to the user. For a text-based
calculator, it would appear in the terminal. For a graphical calculator, the
result appears on the digital display of the calculator window.

• Example of Use Cases:

1. Basic Arithmetic: A user needs to add, subtract, multiply, or divide


numbers quickly.
o Example: "What is 7 + 8?"
o The user enters the numbers, the calculator processes it, and the
result (15) is displayed.
2. Scientific Calculations: A user needs to calculate square roots, sine,
cosine, or logarithms.
o Example: "What is the square root of 16?"
o The calculator processes the input and shows the result (4).
3. Education: Students use digital calculators for homework or exams to
solve math problems more efficiently.
4. Everyday Use: People use calculators for quick financial calculations,
shopping budgets, or converting units
Program :
import tkinter as tk

def press(num):
entry_text.set(entry_text.get() + str(num))

def clear():
entry_text.set("")

def equal():
try:
result = str(eval(entry_text.get()))
entry_text.set(result)
except:
entry_text.set("Error")

# Create main window


window = tk.Tk()
window.title("Digital Calculator")
window.geometry("300x400")
window.resizable(0, 0)

entry_text = tk.StringVar()
entry = tk.Entry(window, textvariable=entry_text, font=('Arial', 20), bd=10, insertwidth=2, width=14,
borderwidth=4, justify='right')
entry.grid(row=0, column=0, columnspan=4)

# Button layout
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), ('.', 4, 1), ('=', 4, 2), ('+', 4, 3),
('C', 5, 0)
]

# Create and place buttons


for (text, row, col) in buttons:
if text == "=":
tk.Button(window, text=text, padx=20, pady=20, font=('Arial', 15),
command=equal).grid(row=row, column=col)
elif text == "C":
tk.Button(window, text=text, padx=140, pady=20, font=('Arial', 15),
command=clear).grid(row=row, column=col, columnspan=4)
else:
tk.Button(window, text=text, padx=20, pady=20, font=('Arial', 15), command=lambda t=text:
press(t)).grid(row=row, column=col)

# Run the GUI loop


window.mainloop()
Program Output :
Conclusion :

In Python, a digital calculator can either be a text-based calculator


that works in the terminal or a graphical calculator using a library like
tkiner. The digital calculator can perform basic or advanced arithmetic
operations, with the results displayed in either text format or on a
graphical display. Whether it's a simple calculator for daily use or a
scientific one for complex calculations, Python allows you to build a
fully functional digital calculator with ease

Reference :
1.Python Official Documentation

• Python Docs: The official Python documentation is the best place to start
for learning about the basic language features, syntax, and modules that
you can use to create a calculator.
• Python Docs

2.Tkinter (For GUI-based Calculators)

• Tutorials: There are many beginner-friendly tutorials that teach you how
to build a GUI calculator using Tkinter.
Example: Python Tkinter Calculator Tutorial
• Tkinter Documentation:Tkinter Documentation

3.Basic Arithmetic and Operations in Python

• Understanding the basics of Python operations (like addition, subtraction,


multiplication, and division) will be crucial when building a digital
calculator. There are many tutorials for beginners that go over these
concepts.
• Real Python (great tutorials and guides for all levels of Python
programming):Real Python

You might also like