Skip to main content

A Geometric Shape Calculator Tool

Project description

Geometool - Geometric Shape Calculation Library

MB Task-1

**New: Added the ability of defining a triangle using kwargs

- Triangle(base, height) 

- Triangle(side1, side2, angle between them in degrees)

This Python package provides functions to calculate the area and perimeter of various geometric shapes.

Installation

You can install the package using pip:

$ pip install geometool

Methods

The package provides the following functions:

  • calculate_area(shape) : Calculates the area of a given shape. Supported shapes include:
    • Circle(radius)
    • Triangle()
  • calculate_perimeter(shape): Calculates the perimeter of a given shape. Supported shapes include:
    • Circle(radius)
    • Triangle()

Classes

Shape

Abstract base class for geometric shapes.

Circle

  • calc_area() to calculate the area.
  • calc_perimeter() to calculate the perimeter.

Triangle

  • calc_area() to calculate the area.
  • calc_perimeter() to calculate the perimeter.
  • is_rightangled() to check if the triangle is right-angled.

Usage

import geometool as g

# Declare a shape object 

s1 = g.Circle(5)
s2 = g.Triangle(6, 8, 9)

# Use calculate_area() and calculate_perimeter() to calculate the area and perimeter of the object
g.calculate_area(s1)
g.calculate_perimeter(s1)
g.calculate_area(s2)
g.calculate_perimeter(s2)

Authors:

Idris Taha

Project details


Download files

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

Source Distribution

geometool-0.1.2.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geometool-0.1.2-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file geometool-0.1.2.tar.gz.

File metadata

  • Download URL: geometool-0.1.2.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for geometool-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c764d5c8864c304da257b3ae6a7e5c2092b065c2a104bbc036072b1b76b672ea
MD5 46360312588153b521ebd52418ac6b52
BLAKE2b-256 1dee6652f39d4cdae417cebdb8e5f1948a3b64bf2834e5cda9a80833e2580919

See more details on using hashes here.

File details

Details for the file geometool-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: geometool-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for geometool-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cca4bb13859e6ed779ec968fbddbe5296c1fc66fafb29522a41f3437a69a8d0e
MD5 30aea0b40576225cc1b8caee41216927
BLAKE2b-256 98318145f78b88112c5c3b3a930eb90da5b2088c0e734762747de8e3f2a88728

See more details on using hashes here.

Supported by

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