python
python
Submitted By
Pooja Sarphale
1
MAHARASHTRA STATE BOARD OF
TECHNICAL EDUCATION, MUMBAI
-: CERTIFICATE: -
2
MAHARASHTRA STATE BOARD OF
TECHNICAL EDUCATION, MUMBAI
3
ACKNOWLEDGMET
Your sincerely
Pooja Sarphale
4
INDEX
1 Rationale 6
5 Actual Methodology 7
9 Application 14
11 Conclusion 15
12 References 15
5
MICRO PROJECT REPORT
Rationale:
6
Course Outcomes Addressed:
Actual Methodology:
7
Source Code:
import math
return x + y
return x - y
return x * y
if y == 0:
return x / y
return x ** y
8
def square_root(x):
if x < 0:
return math.sqrt(x)
def calculator():
while True:
print("Select operation:")
print("1. Add")
print("2. Subtract")
print("3. Multiply")
print("4. Divide")
print("5. Power")
print("7. Exit")
if choice == '7':
break
9
if choice in ('1', '2', '3', '4', '5'):
try:
except ValueError:
continue
if choice == '1':
print(f"Result: {result}")
result = square_root(num)
print(f"Result: {result}")
except ValueError:
else:
if __name__ == "__main__":
calculator()
11
• Output of the Project:
The calculator program runs in the command-line interface and allows users to
perform various arithmetic operations. Sample output:
Select operation:
1. Add
2. Subtract
3. Multiply
4. Divide
5. Power
6. Square Root
7. Exit
Enter choice (1/2/3/4/5/6/7): 1
Enter first number: 10
Enter second number: 5
Result: 15.0
12
13
Skills Developed/Learning Outcomes of this Micro Project:
Application:
14
• Conclusion:
This micro project successfully demonstrates the implementation of a simple
calculator using Python. The project enhances understanding of programming
concepts such as functions, loops, conditional statements, and error handling.
The calculator is functional and can be further extended with additional features
like a graphical user interface (GUI) and scientific calculations.
• References:
15