Excel Basic Forumla Package
Project description
def add(a, b): """ Adds two numbers and returns the result.
Parameters:
a (int or float): The first number.
b (int or float): The second number.
Returns:
int or float: The sum of the two numbers.
"""
return a + b
def sub(a, b): """ Subtracts the second number from the first and returns the result.
Parameters:
a (int or float): The first number.
b (int or float): The second number.
Returns:
int or float: The result of subtracting b from a.
"""
return a - b
def mul(a, b): """ Multiplies two numbers and returns the result.
Parameters:
a (int or float): The first number.
b (int or float): The second number.
Returns:
int or float: The product of the two numbers.
"""
return a * b
def div(a, b): """ Divides the first number by the second and returns the result. If division by zero is attempted, returns an error message.
Parameters:
a (int or float): The numerator.
b (int or float): The denominator.
Returns:
float: The result of division if b is not zero.
str: An error message if b is zero.
"""
if b == 0:
return "cannot divide by zero"
return a / b
def mod(a, b): """ Returns the remainder when the first number is divided by the second.
Parameters:
a (int or float): The numerator.
b (int or float): The denominator.
Returns:
int or float: The remainder of the division.
"""
return a % b
def pow(a, b): """ Raises the first number to the power of the second and returns the result.
Parameters:
a (int or float): The base.
b (int or float): The exponent.
Returns:
int or float: The result of a raised to the power of b.
"""
return a ** b
def avg(*args): """ Calculates the average of a variable number of numeric arguments.
Parameters:
*args (int or float): A variable number of numeric values.
Returns:
float: The average of the numbers provided.
If no arguments are provided, returns 0.
"""
if len(args) == 0:
return 0
return sum(args) / len(args)
def min(*args): """ Returns the smallest value among the provided arguments.
Parameters:
*args (int or float): A variable number of numeric values.
Returns:
int or float: The smallest value in the arguments.
If no arguments are provided, returns None.
"""
if len(args) == 0:
return None
return min(args)
def count(*args): """ Counts the number of valid numeric values in the arguments.
Parameters:
*args: A variable number of values of any type.
Returns:
int: The number of arguments that are integers or floats.
"""
return len([x for x in args if isinstance(x, (int, float))])
def sqrt(number): """ Calculates the square root of a number.
Parameters:
number (int or float): A numeric value.
Returns:
float: The square root of the number if it is non-negative.
str: An error message if the number is negative.
"""
if number < 0:
return "cannot calculate the sqrt because its a negative number"
return number ** 0.5
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vishwa_excel_formulas-1.1.0.tar.gz.
File metadata
- Download URL: vishwa_excel_formulas-1.1.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
798909d35470e2ae66312d735395ae046afee98f0750797fb318ff28e1c45105
|
|
| MD5 |
d84addb0d6a789afb57ea6ed11fd278c
|
|
| BLAKE2b-256 |
9eb4b10db419cd5b9fd1a802fb1044ce9b5e499442f6fc0c690556c7c90fd66e
|
File details
Details for the file vishwa_excel_formulas-1.1.0-py3-none-any.whl.
File metadata
- Download URL: vishwa_excel_formulas-1.1.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d71fe2776079de637a05c0e7b783ad9dd2a369521a62f9f3a5f050bdb3b49004
|
|
| MD5 |
6b500ae290f451b9dd5ddae8b6e18d89
|
|
| BLAKE2b-256 |
e96c090e956a65c6ef2273693a18ebe5923164fac4a16c4c410b9ef84303f374
|