Python Calculator Project Updated2
Python Calculator Project Updated2
3. Output 5-6
4. Concepts Used 7
5. Future Enhancements 8
7. Bibliography 10
1
1. Introduction:
2
2. Source Code:
# Python Calculator
def calculator():
print("Select operation:")
print("1. Addition")
print("2. Subtraction")
print("3. Multiplication")
print("4. Division")
3
choice = input("Enter choice (1/2/3/4): ")
if choice == '1':
print(f"Result: {add(num1, num2)}")
elif choice == '2':
print(f"Result: {subtract(num1, num2)}")
elif choice == '3':
print(f"Result: {multiply(num1, num2)}")
elif choice == '4':
print(f"Result: {divide(num1, num2)}")
else:
print("Invalid Input")
calculator()
4
3. Output:
The output of the project is demonstrated below:
#Output 1:
Select operation:
1. Addition
2. Subtraction
3. Multiplication
4. Division
Enter choice (1/2/3/4): 1
Enter first number: 10
Enter second number: 5
Result: 15.0
#Output 2:
Select operation:
1. Addition
2. Subtraction
3. Multiplication
4. Division
Enter choice (1/2/3/4): 2
Enter first number: 48
Enter second number: 5
Result: 43.0
5
#Output 3:
Select operation:
1. Addition
2. Subtraction
3. Multiplication
4. Division
Enter choice (1/2/3/4): 4
Enter first number: 36
Enter second number: 0
Result: Error: Division by zero is not allowed.
#Output 4:
Select operation:
1. Addition
2. Subtraction
3. Multiplication
4. Division
Enter choice (1/2/3/4): 3
Enter first number: 34
Enter second number: 12
Result: 408.0
6
4. Concepts Used:
7
5. Future Enhancements:
8
6. Advantages and Limitations:
Advantages:
Limitations:
9
7. Bibliography:
3. W3Schools Python:
https://www.w3schools.com/python
10