Hidden WordScanner
Private scans · No account required

DuckieDai Rectangle Area

Calculate a rectangle's area while showing the formula, accepting a user-chosen length unit, and labelling the squared result.

geometry · MIT License

Overview

Calculate a rectangle's area while showing the formula, accepting a user-chosen length unit, and labelling the squared result.

  • Tested on a TI calculator
  • Downloaded 39 times
  • Version 1.0.0
  • 2167 bytes
  • No imports

Before you run it

  • TI-84 Plus CE Python · tested on OS 5.8.3, Python App 5.8.3.0048
  • Sent through TI Connect CE to the Python App; DuckieDai named the calculator copy TEST
  • Width and height describe a rectangle and use the same unit.
  • Each dimension must be greater than zero and below 1e100.
  • The calculated area must be below 1e200.

Try the DuckieDai calculator screen

See the duck opening, enter a unit and dimensions, and follow the prompts through to the area result.

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

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.

Learn the math

How the area of a rectangle works

The idea

Area measures how much flat space a shape covers. For a rectangle it is the width multiplied by the height, and the answer is in square units.

The formula

A = width x height

A
area, in square units
width, height
the two side lengths, in the same unit

Using the program

Worked example

A rectangle is 4 cm wide and 2.5 cm tall. Enter cm, then 4 and 2.5.

A = 4.0 x 2.5

The program shows Area = 10.0 cm^2.

Tips and common mistakes

Where this comes up

Area of a rectangle is the first area formula taught and the basis for every other one. Here it mainly serves as a simple first program to transfer and run.

Read the step-by-step browser preview guide to try a sample and understand what the preview does and does not test.

Exact reviewed bytes

Source code

Download .py

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

  1. """DuckieDai Rectangle Area for TI-84 Plus CE Python."""
  2. def duckiedai_intro(program_name, wait=True):
  3. """Show the small, reusable DuckieDai program opening."""
  4. title = program_name[:16]
  5. empty = 16 - len(title)
  6. left = empty // 2
  7. right = empty - left
  8. print("+----------------------+")
  9. print("| " + " " * left + title + " " * right + " |")
  10. print("| |")
  11. print("| __ |")
  12. print("| ___(o )> quack! |")
  13. print("| \\ <_. ) |")
  14. print("| `---' |")
  15. print("| by DuckieDai |")
  16. print("+----------------------+")
  17. print("Loading...")
  18. if wait:
  19. input("Press enter to start ")
  20. print("\n" * 6)
  21. def positive_number(prompt):
  22. """Ask until the user supplies a positive, finite number."""
  23. while True:
  24. try:
  25. value = float(input(prompt))
  26. if is_positive_finite(value):
  27. return value
  28. except ValueError:
  29. pass
  30. print("Enter a number above 0.")
  31. def is_positive_finite(value):
  32. """Use a practical calculator range without math.isfinite."""
  33. return value > 0 and value < 1e100
  34. def rectangle_area(width, height):
  35. """Return area for two positive, finite dimensions."""
  36. if not is_positive_finite(width) or not is_positive_finite(height):
  37. raise ValueError("dimensions must be positive and finite")
  38. area = width * height
  39. if area >= 1e200:
  40. raise ValueError("area is too large")
  41. return area
  42. def main():
  43. duckiedai_intro("RECTANGLE AREA")
  44. print("RECTANGLE AREA")
  45. print("Formula: A = width x height")
  46. print()
  47. unit = input("Length unit (cm, m, in): ")
  48. if not unit:
  49. unit = "units"
  50. width = positive_number("Width in " + unit + ": ")
  51. height = positive_number("Height in " + unit + ": ")
  52. area = rectangle_area(width, height)
  53. print()
  54. print("A = " + str(width) + " x " + str(height))
  55. print("Area = " + str(area) + " " + unit + "^2")
  56. print()
  57. print("DuckieDai says: done!")
  58. # TI-Python imports the selected AppVar rather than setting __name__ to main.
  59. main()
Filename
rectangle_area.py
Size
2167 bytes
SHA-256
5291290b23032d479d34f740ca41a5a13f96a036636544784054aadfa6478b32

Usage

Inputs

  • Length unit: a short label such as cm, m, or in; blank becomes units
  • Width: positive number below 1e100 in the chosen unit
  • Height: positive number below 1e100 in the chosen unit

Outputs

  • Area: width multiplied by height, labelled with the chosen unit squared

Units: Width and height must share one length unit; output uses that unit squared.

Assumptions and limitations

Assumptions

  • Width and height describe a rectangle and use the same unit.

Constraints

  • Each dimension must be greater than zero and below 1e100.
  • The calculated area must be below 1e200.

Known failures

  • Non-numeric, zero, negative, or excessively large dimensions are rejected and requested again.
  • Very long custom unit labels may wrap on the calculator display.

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; transferred through TI Connect CE as TEST
What happened
The duck opening appeared, and the calculator accepted a unit and rectangle dimensions before displaying the labelled area answer.
Dependencies
No imports
Suggested calculator name
RECTAREA — you can give it another valid, unique name when you transfer it
Desktop test cases
5 cases

The desktop tests cover calculations and error handling. The calculator review above records what was actually checked on the device.

Transfer and launch

Download the .py file, send it to your calculator with TI Connect CE as RECTAREA or another name, then open the Python App and try the worked example on this page first.

Full installation and troubleshooting guide. Check your teacher's or exam's rules before using any program.

Version history

Did a DuckieDai program help with your homework? Every program here is free. If you would like to say thanks, you can leave a tip on Cash App ($duckiedai214) or read what tips pay for.

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, and so does a Yes or No answer about whether the program worked. Your browser notes that you answered; that note is never sent to the site. No entered values, source text, IP address, account, cookie, device identifier, or fingerprint is stored with these counts.