Skip to content

This Python calculator offers two modes: Simple (basic arithmetic) and Chain (chained calculations using previous results).

Notifications You must be signed in to change notification settings

Sudhanshu-Ambastha/Python-Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Python Calculator

Description

This Python program is a simple 4-function calculator that allows users to perform basic arithmetic operations such as addition, multiplication, and division on two integer numbers. It displays a menu for selecting the desired operation, takes user input for two numbers, and calculates the result based on the chosen operation.

Features

  • Addition: Enter '+' to add two numbers.
  • Multiplication: Enter 'X' (uppercase 'X') to multiply two numbers.
  • Division: Enter '/' to divide two numbers.

Usage

Normal Calculator

  1. Run the Calc.py script using Python.
  2. You will see a menu with the available operations:
    • Enter '+' for addition.
    • Enter 'X' for multiplication.
    • Enter '/' for division.
  3. Enter two integer numbers as prompted.
  4. Choose the operation you want to perform based on the menu.
  5. The program will calculate and display the result.

Example:

Menu:

  • : Add X : Multiply / : Divide Enter the first integer: 10 Enter the second integer: 5 Choose an operation (+, X, /): X Result: 50

Chain Calculator

This version of the calculator allows you to perform multiple calculations in sequence. After each calculation, you can use the result as the first number in the next operation.

  1. Run the Chain calc.py script.
  2. You will enter numbers and operations as prompted, and the calculator will continue to calculate based on the result from the previous operation.

Example:

Enter the first integer: 10 Enter the second integer: 5 Choose an operation (+, X, /): X Result: 50 Enter next number: 3 Choose an operation (+, X, /): + Result: 53

Try it Online

You can test the programs online using Trinket by following these links:

Troubleshooting

If you encounter any issues or have questions, please don't hesitate to reach out for support.

About

This Python calculator offers two modes: Simple (basic arithmetic) and Chain (chained calculations using previous results).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages