Skip to main content

Simple Python package that can be used to do calculations with right-angled triangles

Project description

Right Triangle

Simple Python package that can be used to do calculations with right-angled triangles

Installation

Use pip to install right-triangle.

pip install right-triangle

Usage

The RightTriangle instance

A RightTriangle instance has 5 attributes:

  1. a - the length of the first leg of the triangle
  2. b - the length of the second leg of the triangle
  3. c - the length of the hypotenuse of the triangle
  4. a_angle - the angle opposed to leg a, measured in degrees
  5. b_angle - the angle opposed to leg b, measured in degrees

You can instantiate a RightTriangle with the following information:

  • The lengths of any two sides of the triangle
  • One angle and the length of one side of the triangle

During the instantiation the other attributes are calculated and become accessible.

Example

from right_triangle import RightTriangle

# Instantiate a RightTriangle with some of the attributes
rt = RightTriangle(a=3, b=4)

# The other attributes are accessible
print(rt.c)
print(rt.a_angle)
print(rt.b_angle)

# Instantiation with other attributes
rt2 = RightTriangle(c=10, a_angle=rt.a_angle)
print(rt2.a)

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

right-triangle-0.1.0.tar.gz (2.6 kB view hashes)

Uploaded Source

Built Distribution

right_triangle-0.1.0-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

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