Advertisement
endzie_fyrge

[18] Total Resistance

Jul 9th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. resistor_one = float(input("Enter the resistance of the first resistor: "))
  2. resistor_two = float(input("Enter the resistance of the second resistor: "))
  3. circuit_type = input("Enter the circuit type: ")
  4.  
  5. if circuit_type.upper() == "SERIES":
  6.     resistance = resistor_one + resistor_two
  7.     print(f"The total resistance is {resistance} ohms.")
  8. elif circuit_type.upper() == "PARALLEL":
  9.     resistance = resistor_one * resistor_two / (resistor_one + resistor_two)
  10.     print(f"The total resistance is {resistance} ohms.")
  11. else:
  12.     print("Error: The circuit type doesn't exist.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement