← 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.
TI-84 Plus CE Python · screen preview
JavaScript is required for the optional browser simulation. Source viewing and downloading remain available without it.
Exact reviewed bytes
Source code
"""DuckieDai Ohm's Law & Power for TI-84 Plus CE Python."""from math import sqrtdef duckiedai_intro(program_name, wait=True):"""Show the reusable DuckieDai program opening."""title = program_name[:16]empty = 16 - len(title)left = empty // 2right = empty - leftprint("+----------------------+")print("| " + " " * left + title + " " * right + " |")print("| |")print("| __ |")print("| ___(o )> quack! |")print("| \\ <_. ) |")print("| `---' |")print("| by DuckieDai |")print("+----------------------+")print("Loading...")if wait:input("Press enter to start ")print("\n" * 6)def optional_number(prompt):"""Return a nonnegative number or None if blank."""while True:raw = input(prompt)if raw == "":return Nonetry:value = float(raw)if value >= 0 and value < 1e100:return valueexcept ValueError:passprint("Enter 0 or greater")print("or leave blank.")def show_results(v, i, r, p):input("Press enter for results ")print("\n" * 6)print("RESULTS")print()print("Voltage:")print(str(v) + " V")print()print("Current:")print(str(i) + " A")input("Press enter for more ")print("\n" * 6)print("RESULTS CONTINUED")print()print("Resistance:")print(str(r) + " ohms")print()print("Power:")print(str(p) + " W")def main():duckiedai_intro("OHMS LAW")print("OHM'S LAW & POWER")print()print("V = I*R")print("P = I*V")print("P = I^2*R")print("P = V^2/R")input("Press enter for inputs ")print("\n" * 6)print()print("Enter EXACTLY TWO")print("known values.")print()print("Leave unknowns blank.")print()v = optional_number("Voltage V: ")i = optional_number("Current A: ")r = optional_number("Resistance ohm: ")p = optional_number("Power W: ")known = 0if v is not None:known += 1if i is not None:known += 1if r is not None:known += 1if p is not None:known += 1print()if known != 2:print("Enter exactly two")print("known values.")# ==========================================# VOLTAGE + CURRENT## R = V/I# P = V*I# ==========================================elif v is not None and i is not None:if i == 0:print("Cannot determine R")print("when current is 0.")else:r = v / ip = v * iprint("Using:")print("R = V/I")print("P = V*I")show_results(v, i, r, p)# ==========================================# VOLTAGE + RESISTANCE## I = V/R# P = V^2/R# ==========================================elif v is not None and r is not None:if r == 0:print("Resistance cannot")print("be zero.")else:i = v / rp = v ** 2 / rprint("Using:")print("I = V/R")print("P = V^2/R")show_results(v, i, r, p)# ==========================================# CURRENT + RESISTANCE## V = I*R# P = I^2*R# ==========================================elif i is not None and r is not None:if r == 0:print("Resistance cannot")print("be zero.")else:v = i * rp = i ** 2 * rprint("Using:")print("V = I*R")print("P = I^2*R")show_results(v, i, r, p)# ==========================================# POWER + VOLTAGE## I = P/V# R = V^2/P# ==========================================elif p is not None and v is not None:if v == 0 or p == 0:print("Need nonzero V")print("and P to solve.")else:i = p / vr = v ** 2 / pprint("Using:")print("I = P/V")print("R = V^2/P")show_results(v, i, r, p)# ==========================================# POWER + CURRENT## V = P/I# R = P/I^2# ==========================================elif p is not None and i is not None:if i == 0:print("Current cannot")print("be zero.")else:v = p / ir = p / (i ** 2)print("Using:")print("V = P/I")print("R = P/I^2")show_results(v, i, r, p)# ==========================================# POWER + RESISTANCE## I = sqrt(P/R)# V = sqrt(P*R)# ==========================================elif p is not None and r is not None:if r == 0:print("Resistance cannot")print("be zero.")else:i = sqrt(p / r)v = sqrt(p * r)print("Using:")print("I = sqrt(P/R)")print("V = sqrt(P*R)")show_results(v, i, r, p)else:print("Could not solve.")print("Check your values.")print()print("DuckieDai says: done!")# TI-Python imports the selected AppVar rather than# setting __name__ to main.main()
- Filename
OHMSLAW.py- Size
- 5836 bytes
- SHA-256
91be192de445b030b97f4ecd8a6c731bafa2a787ee87f447a16bd056b650c342
Transfer and launch
- Confirm that your calculator is the Python-capable model named above. Check that its OS and Python App versions match the reviewed record.
- Download the
.pysource above and verify its SHA-256 digest if your computer provides that option. - Use TI Connect CE to send the Python file to a compatible calculator.
OHMSLAWis a suggested name; you may choose another valid, unique calculator name. - 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
- 1.0.0 — current version, published . Download this reviewed version
Any source change requires a new immutable version and digest. Historical downloads remain available only while their review records remain valid.