This is a little Python script for learning, nothing serieus, but working.
command = ""
def calc_volt():
var_i = input(" Amp : ")
var_r = input(" Ohm : ")
var_v = round(float(var_i) * float(var_r), 2)
print(str(var_i) + " * " + str(var_r) + " = " + str(var_v) + " volt" + '\n')
def calc_amp():
var_v = input("Volt : ")
var_r = input(" Ohm : ")
var_i = round(float(var_v) / float(var_r), 2)
print(str(var_v) + " / " + str(var_r) + " = " + str(var_i) + " amp" + '\n')
def calc_ohm():
var_v = input("Volt : ")
var_i = input(" Amp : ")
var_r = round(float(var_v) / float(var_i), 2)
print(str(var_v) + " / " + str(var_i) + " = " + str(var_r) + " Ohm" + '\n')
def calc_watt_iv():
var_i = input(" Amp : ")
var_v = input("Volt : ")
var_p = round(float(var_i) * float(var_v), 2)
print(str(var_i) + " * " + str(var_v) + " = " + str(var_p) + " Watt" + '\n')
def calc_watt_pv():
var_p = input("Watt : ")
var_v = input("Volt : ")
var_i = round(float(var_p) / float(var_v), 2)
print(str(var_p) + " / " + str(var_v) + " = " + str(var_i) + " Amp" + '\n')
while(command != 0):
print("Choose what to calculate: ")
print("1: Voltage")
print("2: Ampère")
print("3: Resistance")
print("4: Watt from Volt & Amp DC/AC single phase")
print("5: Amps from Watt & Volt DC/AC single phase")
print("0: Exit")
print("")
command = int(input("Your choice: "))
if(command == 1):
calc_volt()
elif(command == 2):
calc_amp()
elif(command == 3):
calc_ohm()
elif(command == 4):
calc_watt_iv()
elif(command == 5):
calc_watt_pv()
elif(command == 0):
print("Good bye")
else:
print("Not a valid option" + '\n')