GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — small-python-projects/basic_calculator at main · tm4rtin17/small-python-projects

Expand file tree

/

basic_calculator

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

basic_calculator

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
README.md
README.md
 
 
calculator.py
calculator.py
 
 

README.md

Outline

Calculator.py

A simple, beginner-friendly command-line calculator built in Python.

Supports basic arithmetic operations: addition, subtraction, multiplication, and division.

Uses the excellent pyinputplus library for robust, validation-safe user input.

Features

  • Clean numbered menu for choosing operations
  • Validates that inputs are integers
  • Handles basic arithmetic (+ − × ÷)
  • Clear output formatting

Requirements

  • Python 3.6+
  • pyinputplus
pip install pyinputplus
'''

## How to Use

Clone or download the repository
Make sure you have pyinputplus installed
Run the script:
python calculator.py

## Example run:
Enter your first number  42
1. +
2. -
3. *
4. /
Choose an operation (enter a number): 1
Enter your second number  58
The solution is 100.

## Possible Improvements (Ideas for Next Steps)
- Add support for float/decimal numbers
- Add division-by-zero protection
- Allow multiple operations in one session (calculator loop)
- Add more operations (**, %, √, etc.)
- Add history of previous calculations
- Support parentheses / basic expression evaluation
- Add unit tests
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.