Skip to content

Latest commit

 

History

History
67 lines (45 loc) · 1.33 KB

File metadata and controls

67 lines (45 loc) · 1.33 KB

PLP Python Assignment – Basic Calculator Author: Meseret Akalu (Mesi) Project: PLP Python Basics Script: calculator.py Description This is a beginner-friendly Python calculator program that:

Prompts the user to input two numbers.

Asks for a basic math operation (+, -, *, /).

Performs the operation and displays the result in a readable format.

The program includes input validation and handles division by zero like a boss.

Features Addition

Subtraction

Multiplication

Division (with zero check!)

User-friendly prompts 🗣

Clean, readable output

🔧 How to Run Make sure Python is installed (3.x recommended).

Save the script as calculator.py.

Open terminal or command prompt.

Run the script with:

bash Copy Edit python calculator.py 📸 Sample Output mathematica Copy Edit Enter the first number: 10 Enter an operation (+, -, *, /): * Enter the second number: 3 10.0 * 3.0 = 30.0 ⚠️ Error Handling If user tries to divide by zero, an error message will be shown.

If an invalid operation is entered, a warning is displayed.

🔁 Future Upgrades (Ideas 💡) Add power (**) and modulo (%) support

GUI with Tkinter or PyQt

Logging results to a file

Loop until user chooses to exit

🏁 Final Note This is a foundational project submitted for the PLP Python Assignment. Simple logic, solid results. Just like we like it. 🐍💪