DEV Community


Posted on


Ohms calculator using python

Today I written a calculator program to calculate the ohms formula by python programming language...
If you found better way to write it again please let me know directly message me or comment me.

here program starts.

print ("""ohms calculator v1.0
print("""Please enter only numbers unless it will show you an error
print("""Enter minimum 2 values
v=input(str('[Enter value of V]: '))
i=input(str('[Enter value of I]: '))
r=input(str('[Enter value of R]: '))
op=input(str("""[Enter 1 to calculate voltage]

[Enter 2 to calculate Ampere]

[Enter 3 to calculate Resistance]
if op=='1':
elif op=='2':
elif op=='3':

Latest comments (1)

j_mplourde profile image
Jean-Michel Plourde • Edited

This is a very good start. I can see that there would be a problem if I entered a resistance of 0 then selected to calculate the voltage. There should be a try/catch or division by zero verification.

Advice For Junior Developers

Advice from a career of 15+ years for new and beginner developers just getting started on their journey.