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.
- Addition: Enter '+' to add two numbers.
- Multiplication: Enter 'X' (uppercase 'X') to multiply two numbers.
- Division: Enter '/' to divide two numbers.
- Run the
Calc.py
script using Python. - You will see a menu with the available operations:
- Enter '+' for addition.
- Enter 'X' for multiplication.
- Enter '/' for division.
- Enter two integer numbers as prompted.
- Choose the operation you want to perform based on the menu.
- The program will calculate and display the result.
Menu:
- : Add X : Multiply / : Divide Enter the first integer: 10 Enter the second integer: 5 Choose an operation (+, X, /): X Result: 50
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.
- Run the
Chain calc.py
script. - You will enter numbers and operations as prompted, and the calculator will continue to calculate based on the result from the previous operation.
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
You can test the programs online using Trinket by following these links:
If you encounter any issues or have questions, please don't hesitate to reach out for support.