A simple maths package
Project description
Math Operations
Description
This Python module provides basic mathematical operations: addition, subtraction, multiplication, and squaring a number. It is designed to handle multiple arguments for addition, subtraction, and multiplication, and it includes a separate function for squaring a single number.
Functions
1. add(*args)
- Description: Takes multiple arguments and returns their sum.
- Usage:
result = add(1, 2, 3) # returns 6
2. subtract(*args)
- Description: Takes multiple arguments and subtracts them from left to right.
- Usage:
result = subtract(10, 5, 2) # returns 3 (10 - 5 - 2)
3. multiply(*args)
- Description: Takes multiple arguments and returns their product.
- Usage:
result = multiply(2, 3, 4) # returns 24
4. square(num)
- Description: Takes a single argument and returns its square.
- Usage:
result = square(4) # returns 16
Requirements
- Python 3.x
How to Run
- Clone or download the repository.
- Ensure you have Python 3.x installed on your system.
- Import the module into your project or run it directly in a Python script.
Example
from math_operations import add, subtract, multiply, square
print(add(1, 2, 3)) # Output: 6
print(subtract(10, 5, 1)) # Output: 4
print(multiply(2, 3, 4)) # Output: 24
print(square(5)) # Output: 25
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file basic_maths_011-0.3-py3-none-any.whl
.
File metadata
- Download URL: basic_maths_011-0.3-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
16b452de2274bda102ec453f5c5f308399db6983a4c60e5005f2cadb92920111
|
|
MD5 |
aaf0278f9c03cb43469d5fb3d4741491
|
|
BLAKE2b-256 |
245c74b245db4a9b3d0b221692128bcece3f585387da6a76e21befadf81db95e
|