Hidden WordScanner
Private scans · No account required

DuckieDai Ohm's Law and Power

Calculate voltage, current, resistance, and electrical power from exactly two known nonnegative values.

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.

physics · MIT License

Overview

Calculate voltage, current, resistance, and electrical power from exactly two known nonnegative values.

Usage

Inputs

  • Exactly two known values among voltage, current, resistance, and power; unknown values are left blank

Outputs

  • Voltage, current, resistance, and power on paginated result screens

Units: Voltage uses volts, current uses amperes, resistance uses ohms, and power uses watts.

Assumptions and limitations

Assumptions

  • The component is ohmic and the supplied values describe the same operating point.

Constraints

  • Known values must be nonnegative and required divisor values cannot be zero.

Known failures

  • More or fewer than two known values are rejected.
  • Non-ohmic or changing circuit conditions are outside the model.

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 paginated .py transferred through TI Connect CE into RAM and tested individually
What happened
Passed: branded intro, known value entry, Ohm law and power calculation, and multi page voltage/current/resistance/power results ran on the physical calculator
Dependencies
math
Suggested calculator name
OHMSLAW — 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 the DuckieDai calculator screen

Follow the reviewed program's real menu, prompts, validation, calculation, and result flow before downloading.

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 Ohm's Law & Power 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 optional_number(prompt):
  23. """Return a nonnegative number or None if blank."""
  24. while True:
  25. raw = input(prompt)
  26. if raw == "":
  27. return None
  28. try:
  29. value = float(raw)
  30. if value >= 0 and value < 1e100:
  31. return value
  32. except ValueError:
  33. pass
  34. print("Enter 0 or greater")
  35. print("or leave blank.")
  36. def show_results(v, i, r, p):
  37. input("Press enter for results ")
  38. print("\n" * 6)
  39. print("RESULTS")
  40. print()
  41. print("Voltage:")
  42. print(str(v) + " V")
  43. print()
  44. print("Current:")
  45. print(str(i) + " A")
  46. input("Press enter for more ")
  47. print("\n" * 6)
  48. print("RESULTS CONTINUED")
  49. print()
  50. print("Resistance:")
  51. print(str(r) + " ohms")
  52. print()
  53. print("Power:")
  54. print(str(p) + " W")
  55. def main():
  56. duckiedai_intro("OHMS LAW")
  57. print("OHM'S LAW & POWER")
  58. print()
  59. print("V = I*R")
  60. print("P = I*V")
  61. print("P = I^2*R")
  62. print("P = V^2/R")
  63. input("Press enter for inputs ")
  64. print("\n" * 6)
  65. print()
  66. print("Enter EXACTLY TWO")
  67. print("known values.")
  68. print()
  69. print("Leave unknowns blank.")
  70. print()
  71. v = optional_number("Voltage V: ")
  72. i = optional_number("Current A: ")
  73. r = optional_number("Resistance ohm: ")
  74. p = optional_number("Power W: ")
  75. known = 0
  76. if v is not None:
  77. known += 1
  78. if i is not None:
  79. known += 1
  80. if r is not None:
  81. known += 1
  82. if p is not None:
  83. known += 1
  84. print()
  85. if known != 2:
  86. print("Enter exactly two")
  87. print("known values.")
  88. # ==========================================
  89. # VOLTAGE + CURRENT
  90. #
  91. # R = V/I
  92. # P = V*I
  93. # ==========================================
  94. elif v is not None and i is not None:
  95. if i == 0:
  96. print("Cannot determine R")
  97. print("when current is 0.")
  98. else:
  99. r = v / i
  100. p = v * i
  101. print("Using:")
  102. print("R = V/I")
  103. print("P = V*I")
  104. show_results(v, i, r, p)
  105. # ==========================================
  106. # VOLTAGE + RESISTANCE
  107. #
  108. # I = V/R
  109. # P = V^2/R
  110. # ==========================================
  111. elif v is not None and r is not None:
  112. if r == 0:
  113. print("Resistance cannot")
  114. print("be zero.")
  115. else:
  116. i = v / r
  117. p = v ** 2 / r
  118. print("Using:")
  119. print("I = V/R")
  120. print("P = V^2/R")
  121. show_results(v, i, r, p)
  122. # ==========================================
  123. # CURRENT + RESISTANCE
  124. #
  125. # V = I*R
  126. # P = I^2*R
  127. # ==========================================
  128. elif i is not None and r is not None:
  129. if r == 0:
  130. print("Resistance cannot")
  131. print("be zero.")
  132. else:
  133. v = i * r
  134. p = i ** 2 * r
  135. print("Using:")
  136. print("V = I*R")
  137. print("P = I^2*R")
  138. show_results(v, i, r, p)
  139. # ==========================================
  140. # POWER + VOLTAGE
  141. #
  142. # I = P/V
  143. # R = V^2/P
  144. # ==========================================
  145. elif p is not None and v is not None:
  146. if v == 0 or p == 0:
  147. print("Need nonzero V")
  148. print("and P to solve.")
  149. else:
  150. i = p / v
  151. r = v ** 2 / p
  152. print("Using:")
  153. print("I = P/V")
  154. print("R = V^2/P")
  155. show_results(v, i, r, p)
  156. # ==========================================
  157. # POWER + CURRENT
  158. #
  159. # V = P/I
  160. # R = P/I^2
  161. # ==========================================
  162. elif p is not None and i is not None:
  163. if i == 0:
  164. print("Current cannot")
  165. print("be zero.")
  166. else:
  167. v = p / i
  168. r = p / (i ** 2)
  169. print("Using:")
  170. print("V = P/I")
  171. print("R = P/I^2")
  172. show_results(v, i, r, p)
  173. # ==========================================
  174. # POWER + RESISTANCE
  175. #
  176. # I = sqrt(P/R)
  177. # V = sqrt(P*R)
  178. # ==========================================
  179. elif p is not None and r is not None:
  180. if r == 0:
  181. print("Resistance cannot")
  182. print("be zero.")
  183. else:
  184. i = sqrt(p / r)
  185. v = sqrt(p * r)
  186. print("Using:")
  187. print("I = sqrt(P/R)")
  188. print("V = sqrt(P*R)")
  189. show_results(v, i, r, p)
  190. else:
  191. print("Could not solve.")
  192. print("Check your values.")
  193. print()
  194. print("DuckieDai says: done!")
  195. # TI-Python imports the selected AppVar rather than
  196. # setting __name__ to main.
  197. main()
Filename
OHMSLAW.py
Size
5836 bytes
SHA-256
91be192de445b030b97f4ecd8a6c731bafa2a787ee87f447a16bd056b650c342

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. OHMSLAW 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.