Create a function that calculates the missing value of 3 inputs using Ohm's law. The inputs are v
, r
or i
(aka: voltage, resistance and current).
Ohm's law:
V = R * I
Return the missing value rounded to two decimal places.
ohms_law(v=12, r=220) ➞ 0.05
ohms_law(v=230, i=2) ➞ 115
ohms_law(r=220, i=0.02) ➞ 4.4
ohms_law(i=10) ➞ "Invalid"
ohms_law(v=500, r=50, i=10) ➞ "Invalid"
- Missing values will be None
- If there is more than one missing value, or no missing value, return
"Invalid"
- Only numbers will be given.