Skip to content

GianPalmares/Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Calculator

Calculator Program README Description This Python program serves as a simple calculator that performs basic arithmetic operations such as addition, subtraction, multiplication, division, modulus, and exponentiation. The user is prompted to input two numeric values and an operator to perform the desired operation.

Features User Input Handling:

The program ensures that user input for numeric values is valid, repeatedly prompting the user until valid numeric input is provided. Operator Handling:

The user is prompted to enter a valid operator (+, -, *, /, %, **) for the desired arithmetic operation. If an invalid operator is entered, the program informs the user and prompts them to enter a valid one. Arithmetic Operations:

The program includes functions for addition, subtraction, multiplication, division, modulus, and exponentiation. Special handling is implemented for cases where division or modulus by zero may occur. Swap Input Handling:

In cases where subtraction, division, or modulus might result in negative or undefined values, the program provides the option to swap the input values for the operation. Infinite Loop Error Handling:

The program utilizes infinite loops with error handling to ensure that the user provides valid input for numeric values, preventing crashes due to non-numeric input. How to Use Run the Program:

Execute the program in a Python environment. Enter Numeric Values:

Input the first numeric value when prompted. Input the second numeric value when prompted. Enter Operator:

Input one of the following operators: +, -, *, /, %, **. View Result:

The program will display the result of the arithmetic operation based on the entered values and operator.

Note The program has a commented-out section in the division and modulus functions that handles division or modulus by zero. Depending on your preferences, you can choose to include or exclude this section.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages