Hidden WordScanner
Private scans · No account required

DuckieDai Heron's Formula

Calculate a triangle's area, perimeter, and semiperimeter from three side lengths.

Version 1.0.0 · Tested on a TI calculator

← Back to Calculator Program Library

Independent compatibility resource: Hidden Word Scanner is independent and is not affiliated with or endorsed by Texas Instruments. TI product names describe compatibility only.

Action-count privacy: Successful downloads, preview starts, and preview completions increment same-origin aggregate counters. No entered values, source text, IP address, account, cookie, device identifier, or fingerprint is stored with these counts.

geometry · MIT License

Overview

Calculate a triangle's area, perimeter, and semiperimeter from three side lengths.

Usage

Inputs

  • Three positive side lengths

Outputs

  • Triangle area, perimeter, and semiperimeter

Units: Use one consistent length unit; area uses that unit squared.

Assumptions and limitations

Assumptions

  • The three values form a nondegenerate triangle.

Constraints

  • Each side must be positive and the triangle inequality must hold.

Known failures

  • Invalid side sets are rejected.
  • Inconsistent units produce an incorrect result.

Compatibility and review

Review status
Tested on a TI calculator
Tested on
TI-84 Plus CE Python; OS 5.8.3; Python App 5.8.3.0048; exact source owner-tested through TI Connect CE
What happened
Owner confirmed the supplied Heron's formula program runs on the physical calculator.
Dependencies
math
Suggested calculator name
HERON — you can give it another valid, unique name when you transfer it
Desktop test cases
Not available for this interactive-only source

This exact source auto-launches an interactive calculator session, so compatibility evidence comes from the recorded physical-device review rather than an importable desktop fixture.

Browser preview

Try Heron's formula

This browser preview calculates a valid triangle's area from its three sides.

Simulation boundary: This preview uses a reviewed browser adapter. It does not execute the downloaded Python and does not prove TI-Python or calculator compatibility.

JavaScript is required for the optional browser simulation. Source viewing and downloading remain available without it.

Exact reviewed bytes

Source code

Download .py

View source below, copy it when JavaScript is available, or download the exact .py bytes.

  1. """DuckieDai Heron's Formula for TI-84 Plus CE Python."""
  2. from math import sqrt
  3. def duckiedai_intro(program_name, wait=True):
  4. """Show the reusable DuckieDai program opening."""
  5. title = program_name[:16]
  6. empty = 16 - len(title)
  7. left = empty // 2
  8. right = empty - left
  9. print("+----------------------+")
  10. print("| " + " " * left + title + " " * right + " |")
  11. print("| |")
  12. print("| __ |")
  13. print("| ___(o )> quack! |")
  14. print("| \\ <_. ) |")
  15. print("| `---' |")
  16. print("| by DuckieDai |")
  17. print("+----------------------+")
  18. print("Loading...")
  19. if wait:
  20. input("Press enter to start ")
  21. print("\n" * 6)
  22. def positive_number(prompt):
  23. """Require a number greater than zero."""
  24. while True:
  25. try:
  26. value = float(input(prompt))
  27. if value > 0 and value < 1e100:
  28. return value
  29. except ValueError:
  30. pass
  31. print("Enter a number above 0.")
  32. def valid_triangle(a, b, c):
  33. """Check the triangle inequality."""
  34. return (
  35. a + b > c and
  36. a + c > b and
  37. b + c > a
  38. )
  39. def heron_area(a, b, c):
  40. """Calculate triangle area using Heron's Formula."""
  41. s = (a + b + c) / 2
  42. area = sqrt(
  43. s *
  44. (s - a) *
  45. (s - b) *
  46. (s - c)
  47. )
  48. return s, area
  49. def main():
  50. duckiedai_intro("HERONS FORMULA")
  51. print("HERON'S FORMULA")
  52. print("TRIANGLE AREA")
  53. print()
  54. print("A = sqrt(")
  55. print("s(s-a)(s-b)(s-c))")
  56. print()
  57. print("s = (a+b+c)/2")
  58. print()
  59. a = positive_number("Side a: ")
  60. b = positive_number("Side b: ")
  61. c = positive_number("Side c: ")
  62. print()
  63. if not valid_triangle(a, b, c):
  64. print("INVALID TRIANGLE")
  65. print()
  66. print("These side lengths")
  67. print("cannot form a")
  68. print("triangle.")
  69. else:
  70. s, area = heron_area(a, b, c)
  71. perimeter = a + b + c
  72. print("Using:")
  73. print("s = (a+b+c)/2")
  74. print()
  75. print("s = " + str(s))
  76. print()
  77. print("A = sqrt(")
  78. print("s(s-a)(s-b)(s-c))")
  79. print()
  80. print("RESULTS")
  81. print()
  82. print("Perimeter =")
  83. print(str(perimeter))
  84. print()
  85. print("Semiperimeter =")
  86. print(str(s))
  87. print()
  88. print("Area =")
  89. print(str(area))
  90. print("square units")
  91. print()
  92. print("DuckieDai says: done!")
  93. # TI-Python imports the selected AppVar rather than
  94. # setting __name__ to main.
  95. main()
Filename
HERON.py
Size
2772 bytes
SHA-256
f3100020895192b51d053c34e245d65eb4b1f606ff63c263daecc839a9ddffc3

Transfer and launch

  1. Confirm that your calculator is the Python-capable model named above. Check that its OS and Python App versions match the reviewed record.
  2. Download the .py source above and verify its SHA-256 digest if your computer provides that option.
  3. Use TI Connect CE to send the Python file to a compatible calculator. HERON is a suggested name; you may choose another valid, unique calculator name.
  4. Open the Python App, select the program, and check sample inputs before relying on other results.

Read the complete installation, launch, troubleshooting, and removal guide.

Availability does not mean a teacher, school, or exam permits this program. Follow the applicable rules.

Version history

Any source change requires a new immutable version and digest. Historical downloads remain available only while their review records remain valid.