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.3-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: calcutils-0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.4 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c605d902b7d04a9205cf98caec31b097d5c4e11675e8e29f50a7700e8199c9c2
MD5 246f24ee75a4e5b6f6566c7fe49306f2
BLAKE2b-256 9d947b4bb5ddc3217db1c71714e8bd822b8486074731d56b1316595563f6e266

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