how to implement the input of variables by keyboard in the next python program that calculates resistances in parallel?
# 1/R = 1/R1 + 1/R2 + 1/R3 +.....+ 1/Rn
class ParallelResistance: # class ParallelResistance
# this function calculate the resistance in parallel
def calculate(self, *agrs):
total = 0 # taking total resistance as 0
for resistance in agrs:
# calculating 1/R1 + 1/R2 + 1/R3 +.....+ 1/Rn
total = total + 1/resistance
result = 1/total # calculate 1/R
return round(result, 2) # return the total resistance in parallel
parallel = ParallelResistance() # creating a instance of ParallelResistance class
print("The resistance in parallel is: ")
print(parallel.calculate(200,470,220)) # calling the calculate method of ParallelResistance class