Welcome to the Python Beginner Coding Assessment!
In this project, you’ll build a simple calculator that runs in the console — no graphics or frameworks needed.
Create a program that performs addition, subtraction, multiplication, and division based on user input.
By completing this assessment, you’ll practice:
- Getting user input with
input() - Performing arithmetic operations
- Using functions to organize your code
- Applying if/elif/else conditionals
- Handling invalid input and errors
- Optionally repeating actions with loops
Your program must:
- Display a menu with four operation choices:
Select operation: 1. Add 2. Subtract 3. Multiply 4. Divide - Ask the user to select an operation (1–4).
- Ask for two numbers as input.
- Perform the selected operation and print the result.
- Handle the following cases:
- Division by zero → show an error message
- Invalid menu choice → prompt again
- Non-numeric input → display an error message
- (Optional) Ask if the user wants to perform another calculation before exiting.
git clone https://github.com/your-org/python-calculator-assessment.git
cd python-calculator-assessmentOr download the ZIP file and open it in your preferred editor (VS Code, IDLE, etc.).
Create a file named:
calculator.py
You’ll write all your code in this file.
- Save your file as
calculator.py. - Open your terminal and navigate to the project directory.
- Run the program:
or on some systems:
python calculator.py
python3 calculator.py
Select operation:
1. Add
2. Subtract
3. Multiply
4. Divide
Enter choice (1/2/3/4): 3
Enter first number: 4
Enter second number: 7
Result: 28
Do you want to perform another calculation? (yes/no): no
Goodbye!
- Add power (xⁿ) or modulus (%) operations
- Format results to two decimal places
- Store calculation history in a list
- Let users chain calculations without restarting
When you’re done:
git add calculator.py
git commit -m "Complete calculator assessment"
git push origin mainThis exercise is part of the HireUp Beginner Python Series — designed to help you build confidence with real coding tasks.