PyTutorial

Simple Calculator

#Arithmetic Operations

A script that performs basic math operations based on user input.

python
# This function adds two numbers
def add(x, y):
    return x + y

# This function subtracts two numbers
def subtract(x, y):
    return x - y

print("Select operation.")
print("1.Add")
print("2.Subtract")