Skip to content

Aafrakhan/Simple-Calculator-Coding-Practice-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿงฎ Simple Calculator

A basic command-line calculator built in Python that performs addition, subtraction, multiplication, and division. This was one of my early mini-projects while learning Python fundamentals.

๐Ÿ“‹ About the Project

Simple Calculator is a text-based tool that takes two numbers and an operator from the user, then returns the calculated result โ€” with built-in handling for invalid operators and division by zero.

โœจ Features

  • Supports all four basic operations: +, -, *, /
  • Handles division by zero gracefully with an error message
  • Handles invalid operator input
  • Works with decimal (float) numbers

๐ŸŽฎ How It Works

The calculator() function:

  1. Prompts the user for a first number, an operator, and a second number
  2. Checks the operator and performs the matching calculation
  3. Prints the result โ€” or a friendly error message if something goes wrong

๐Ÿš€ Getting Started

Prerequisites

  • Python 3.x installed on your machine

Running the Calculator

  1. Clone this repository
    git clone https://github.com/Aafrakhan/Simple-Calculator.git
  2. Navigate to the project folder
    cd Simple-Calculator
  3. Run the script
    python Simple_Calculator.py
  4. Follow the prompts to enter your numbers and operator

๐Ÿ–ฅ๏ธ Sample Run

Welcome to Python Calculator
Enter first number: 2
Enter operator (+, -, *, /): -
Enter second number: 3
Result: -1.0

๐Ÿ› ๏ธ Built With

  • Python โ€” functions, conditionals, and user input handling

๐Ÿ“š What I Learned

This project helped me practice:

  • Writing reusable functions
  • Using if/elif/else chains to handle multiple cases
  • Type conversion with float()
  • Basic error handling (division by zero, invalid input)

๐Ÿ‘ฉโ€๐Ÿ’ป Author

Aafra Khan GitHub: @Aafrakhan


โญ If you liked this project, feel free to star the repo!

About

A basic command-line calculator built in Python that performs addition, subtraction, multiplication, and division. This was one of my early mini-projects while learning Python fundamentals.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors