Skip to main content

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

  1. Clone or download the repository.
  2. Ensure you have Python 3.x installed on your system.
  3. 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


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

basic_maths_011-0.3-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

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

Hashes for basic_maths_011-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 16b452de2274bda102ec453f5c5f308399db6983a4c60e5005f2cadb92920111
MD5 aaf0278f9c03cb43469d5fb3d4741491
BLAKE2b-256 245c74b245db4a9b3d0b221692128bcece3f585387da6a76e21befadf81db95e

See more details on using hashes here.

Supported by

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