Skip to main content

Utility functions for basic arithmetic calculations

Project description

CalcUtils

CalcUtils is a Python package providing various mathematical functions.

Installation

You can install CalcUtils from PyPI using pip:

pip install calcutils

Usage

from calcutils import *

# Addition
result = add(5, 3)  # result = 8

# Subtraction
result = subtract(10, 4)  # result = 6

# Multiplication
result = multiply(2, 5)  # result = 10

# Division
result = divide(10, 2)  # result = 5.0

# Greatest Common Divisor (GCD)
result = gcd([12, 8, 16])  # result = 4

# Decimal to Percentage
result = decimal_to_percent(0.25)  # result = 25.0

# Calculate Percentage
result = calculate_percentage(25, 100)  # result = 25.0

# Round Up
result = round_up(4.3)  # result = 5

# BMI (Body Mass Index)
result = bmi(70, 175)  # result ≈ 22.86

# Rounded BMI
result = rounded_bmi(70, 175)  # result = 23

Functions

add(a, b)

Adds two numbers together.

subtract(a, b)

Subtracts one number from another.

multiply(a, b)

Multiplies two numbers together.

divide(a, b)

Divides one number by another.

gcd(numbers)

Finds the Greatest Common Divisor (GCD) of a list of integers.

decimal_to_percent(decimal)

Converts a decimal number to a percentage.

calculate_percentage(part, whole)

Calculates the percentage of a part compared to a whole.

round_up(number)

Rounds a number up to the nearest integer.

bmi(weight, height)

Calculates the Body Mass Index (BMI) given weight (in kilograms) and height (in centimeters).

rounded_bmi(weight, height)

Calculates the BMI and rounds it up to the nearest integer.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

calcutils-0.2-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file calcutils-0.2-py3-none-any.whl.

File metadata

  • Download URL: calcutils-0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for calcutils-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5a9cd8335dad0292f0b8d74c29eea0838a3c5e88dd17107d15daf6e29cee7e63
MD5 e9438b66aa28e830b307a3451515543c
BLAKE2b-256 da02206257b5c9ad8f390e5093e46c236db7cc7bc3ec0398991a423eddfc351a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page