Hidden WordScanner
Private scans · No account required

DuckieDai Physics Unit Converter

Convert physics units both ways across 10 categories, from length, speed, and temperature to force, energy, and pressure, with the work and the conversion factor shown.

physics · MIT License

Overview

Convert physics units both ways across 10 categories, from length, speed, and temperature to force, energy, and pressure, with the work and the conversion factor shown.

  • Owner-tested on a TI calculator
  • Version 1.0.0
  • 2590 bytes
  • No imports

Before you run it

  • TI-84 Plus CE Python · No calculator OS or Python App version has been verified.
  • TI Connect CE .py transfer to the Python App; the owner's transfer details were not recorded
  • Each conversion uses the exact or standard factor shown on the result screen, such as 1 in = 2.54 cm or 1 cal = 4.184 J.
  • Temperatures are converted with the Celsius, Fahrenheit, and kelvin formulas, not a single factor.
  • A value may be a decimal or a fraction a/b; the bottom of a fraction cannot be 0.

Try the DuckieDai calculator screen

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

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 to convert units in physics

The idea

A measurement is a number and a unit together. Converting changes the unit, so the number has to change the other way: a meter is 100 centimeters, so 3 m is 300 cm. The amount itself stays the same.

Most physics formulas expect SI units: meters, kilograms, seconds, m/s, kelvin, newtons, joules, and pascals. Converting a given value into SI before using a formula is one of the most common steps in a physics problem, and a skipped conversion is one of the most common lost points.

The formula

going to the second unit: value * factor

going back to the first unit: value / factor

C to F: x*9/5+32, F to C: (x-32)*5/9, C to K: x+273.15

factor
how many of the second unit make one of the first, such as 1 mph = 0.44704 m/s
x
the value you typed
SI units
the base units most physics formulas are written for

Using the program

Worked example

A car drives at 60 mph. What is that in m/s? Choose 4 Speed, then 1 mph / m/s, then 1 for mph to m/s, and type 60.

60 * 0.44704 = 26.8224

The program shows 26.8224 m/s with Work: x * 0.44704.

A fever thermometer reads 98.6 F. Choose 5 Temp, then 1 C / F, then 2 for F to C, and type 98.6. The program shows 37 C with Work: (x-32)*5/9.

Room temperature, 25 C, is 298.15 K: choose 5 Temp, then 2 C / K, then 1, and type 25.

Tips and common mistakes

Where this comes up

Unit conversion is the first skill in nearly every physics and chemistry course, and it comes back in every unit, from kinematics and forces to energy, gases, and pressure.

Exact reviewed bytes

Source code

Download .py

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

  1. N=("Length","Mass","Time","Speed","Temp","Area","Volume","Force","Energy","Pressure")
  2. P=((("m","cm",100),("km","m",1000),("ft","m",.3048),("in","cm",2.54)),
  3. (("kg","g",1000),("lb","kg",.45359237),("g","mg",1000)),
  4. (("hr","s",3600),("min","s",60),("day","hr",24)),
  5. (("mph","m/s",.44704),("km/h","m/s",1/3.6),("ft/s","m/s",.3048)),
  6. (("C","F",0),("C","K",1),("F","K",2)),
  7. (("m2","cm2",1e4),("km2","m2",1e6)),
  8. (("L","m3",.001),("mL","L",.001),("cm3","m3",1e-6)),
  9. (("lbf","N",4.4482216152605),("kgf","N",9.80665)),
  10. (("kJ","J",1000),("cal","J",4.184),("kcal","J",4184),("kWh","J",3.6e6)),
  11. (("atm","Pa",101325),("kPa","Pa",1000),("psi","Pa",6894.757293168)))
  12. def clr():print("\n"*11)
  13. def pg():input("[enter]");clr()
  14. def fmt(x):
  15. if abs(x)<1e15 and abs(x-round(x))<1e-9:return str(int(round(x)))
  16. return "%.6g"%x
  17. def pick(t,L):
  18. while 1:
  19. clr();print(t)
  20. for i in range(0,len(L),2):print(" ".join(str(j+1)+" "+L[j] for j in range(i,min(i+2,len(L)))))
  21. s=input("Choice (blank=back)? ").strip()
  22. if not s:return -1
  23. try:
  24. n=int(s)-1
  25. if 0<=n<len(L):return n
  26. except ValueError:pass
  27. def num(p):
  28. while 1:
  29. s=input(p).strip()
  30. if not s:return None
  31. try:
  32. if "/" in s:a,b=s.split("/");return float(a)/float(b)
  33. return float(s)
  34. except (ValueError,ZeroDivisionError):print("Number or a/b")
  35. def tmp(k,f,x):
  36. if k==0:return (x*9/5+32,"x*9/5+32",x+273.15) if f else ((x-32)*5/9,"(x-32)*5/9",(x-32)*5/9+273.15)
  37. if k==1:return (x+273.15,"x+273.15",x+273.15) if f else (x-273.15,"x-273.15",x)
  38. a=(x-32)*5/9+273.15
  39. return (a,"(x-32)*5/9+273.15",a) if f else ((x-273.15)*9/5+32,"(x-273.15)*9/5+32",x)
  40. def run(g,i):
  41. l,r,c=P[g][i]
  42. while 1:
  43. clr();print("1 "+l+" -> "+r+"\n2 "+r+" -> "+l)
  44. w=input("Direction (blank=back)? ").strip()
  45. if not w:return
  46. if w not in("1","2"):continue
  47. f=w=="1";a,b=(l,r) if f else (r,l)
  48. v=num("Value in "+a+"? ")
  49. if v is None:continue
  50. if g==4:
  51. y,h,k=tmp(i,f,v)
  52. if k<-1e-9:clr();print("Below absolute zero!");pg();continue
  53. else:y=v*c if f else v/c;h=("x * " if f else "x / ")+fmt(c)
  54. clr();print("DuckieDai RESULT\n"+fmt(v)+" "+a+" =\n"+fmt(y)+" "+b+"\nWork: "+h)
  55. if g!=4:print("(1 "+l+" = "+fmt(c)+" "+r+")")
  56. print("Round per class rules");pg()
  57. def main():
  58. clr();print("PHYS UNIT CONVERTER\n __\n ___(o )> quack!\n \\ <_. )\n `---'\nDuckieDai (TM)\nhiddenwordscanner.com\nBlank entry = back");pg()
  59. while 1:
  60. g=pick("PHYSUNIT - DuckieDai",N)
  61. if g<0:break
  62. L=[l+" / "+r for l,r,c in P[g]]
  63. while 1:
  64. i=pick(N[g],L)
  65. if i<0:break
  66. run(g,i)
  67. clr();print("Quack! Goodbye\nDuckieDai (TM)\nhiddenwordscanner.com")
  68. main()
Filename
PHYSUNIT.py
Size
2590 bytes
SHA-256
6eadd5329608e01f94609385aed38913d224332e157ccc007f0f60953c5dfe24

Usage

Inputs

  • A category: Length, Mass, Time, Speed, Temp, Area, Volume, Force, Energy, or Pressure
  • A pair of units and a direction, such as 1 for mph to m/s or 2 for m/s to mph
  • The value to convert; a blank entry goes back

Outputs

  • The converted value with its unit, the work as x * factor or x / factor, and the conversion factor
  • For temperature, the formula used, such as (x-32)*5/9

Units: Metric and US customary units in 10 categories, including m/s, kelvin, newtons, joules, and pascals.

Assumptions and limitations

Assumptions

  • Each conversion uses the exact or standard factor shown on the result screen, such as 1 in = 2.54 cm or 1 cal = 4.184 J.
  • Temperatures are converted with the Celsius, Fahrenheit, and kelvin formulas, not a single factor.

Constraints

  • A value may be a decimal or a fraction a/b; the bottom of a fraction cannot be 0.
  • A temperature below absolute zero is refused.

Known failures

  • Answers that are not whole numbers show 6 significant digits, so round them as your class asks.
  • Only the 30 unit pairs on the menus are included; chain two conversions for others, such as mi to m through km.
  • inf and nan are accepted as values and shown as inf or nan.

Compatibility and review

Review status
Owner-tested on a TI calculator
Tested on
Owner reports personally running this program on a TI-84 Plus CE Python calculator; the test date, OS version, and Python App version were not recorded
What happened
Owner reported pass on the calculator for this exact file. It is published unchanged.
Dependencies
No imports
Suggested calculator name
PHYSUNIT — 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.

Transfer and launch

Download the .py file, send it to your calculator with TI Connect CE as PHYSUNIT or another name, then open the Python App and try the worked example on this page first. This release has no verified calculator OS or Python App version; treat transfer and execution as unverified until independently tested.

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.