# Ohms wheeeeel # # There are four values(watts, ohms, amps, voltage) and # three equations to determine each. You only need # two values to determine all four equations. # # e = volt = r * i, p / i, sqrt(p * r) # i = amp = sqrt(p / r), p / e, e / r # r = ohm = e / i, e**2 / p, p / i**2 # p = watt = e**2 / r, i**2 * r, e * i #print "What is the voltage?" e = 123 #print "The voltage is", e, "." #print "What is the amperage?" i = 2232 #print "The amperage is", i,"." #print "What is the resistance?" r = 56 #print "The resistance is", r,"." #print "What is the p p p p power?" p = 1231 #print "The p p p p p POWER is", p, "." # first trial function calculating voltage def volt(i, r, p, e): # ? if p == 0: e = r * i return e else: e = p / i return e print volt(i, r, p, e)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question