/Terminal-Python-Calculator

Terminal Calculator | Python | Saylor Academy | Enhancements: Hosted on Google Colab for improved visuals | Function: Performs calculations

Primary LanguagePython

# Terminal Python Calculator

This Python script is a command-line calculator that allows users to perform basic arithmetic operations: addition, subtraction, multiplication, division, and exponentiation.

## Features

- Add two numbers
- Subtract two numbers
- Multiply two numbers
- Divide two numbers (checks for division by zero)
- Exponentiate two numbers

## How It Works

1. The user selects an operation from the menu:
   - 1: Add
   - 2: Subtract
   - 3: Multiply
   - 4: Divide
   - 5: Exponentiate
2. The script prompts the user to enter two numbers.
3. Based on the selected operation, it performs the calculation and displays the result.
4. If division by zero is attempted, an error message will display instead of a result.

## Usage
1. Open Google Colab link and click play button to run. You may need to sign in to Google to run the code.

OR

1. Run the script:
   ```bash
   python main.py
  1. Follow the prompts to select an operation and input numbers.

Example

Please enter an option
   1: Add two numbers
   2: Subtract two numbers
   3: Multiply two numbers
   4: Divide two numbers
   5: Exponentiate two numbers
Your choice: 1

Please enter the first number
First number: 5
Please enter the second number
Second number: 3

a+b= 8.0
Bye Bye

Notes

  • Make sure to input numbers only; entering other characters may result in an error.
  • This script requires Python 3.

License

No specific license. Feel free to use, modify, and share this code.