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


Release history Release notifications

Download files

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

Files for right-triangle, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size right_triangle-0.1.0-py3-none-any.whl (3.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size right-triangle-0.1.0.tar.gz (2.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page