Skip to content

Using in Python

Avighna edited this page Mar 6, 2023 · 2 revisions

Requirements

  • Python >= 3.10

Installation

Install the library using pip, or by manually downloading the binaries from here

Full demonstration

Before getting into details, here's a python program that uses all the available functions.

import basic_math_operations as bmo

num1 = input("Enter the first number: ")
num2 = input("Enter the second number: ")

# Add the numbers.
add = bmo.add(num1, num2)

# Subtract the numbers.
subtract = bmo.subtract(num1, num2)

# Multiply the numbers
multiply = bmo.multiply(num1, num2)

# Divide the numbers with accuracy 100.
divide = bmo.divide(num1, num2, 100)

# Find the remainder (modulo).
mod = bmo.mod(num1, num2)

# Print the results
print(num1 + " + " + num2 + " = " + add)
print(num1 + " - " + num2 + " = " + subtract)
print(num1 + " × " + num2 + " = " + multiply)
print(num1 + " ÷ " + num2 + " = " + divide)
print(num1 + " mod " + num2 + " = " + mod)
Clone this wiki locally